Need Help: Preventing Multiple Additions of Marketo Munchkin Script Tag in SPA using Adobe Launch. | Community
Skip to main content
December 21, 2023
Solved

Need Help: Preventing Multiple Additions of Marketo Munchkin Script Tag in SPA using Adobe Launch.

  • December 21, 2023
  • 1 reply
  • 1097 views

I am integrating the Marketo Munchkin script tag into a Single Page Application (SPA) through Adobe Launch. During the initial page load, I am initializing the Munchkin script tag. When transitioning from one view to another, I use the 'Munchkin.munchkinFunction('visitWebPage')' method if it is a page load. For any click-link event, I utilize the 'Munchkin.munchkinFunction('clickLink')' method. However, I am encountering an issue where the Munchkin script tag is being added multiple times. In an SPA, there should only be one Munchkin script tag, even when moving from one view to another. How can I prevent it from being added multiple times?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by abhinavbalooni

Hey @krishnava 

 

How are you calling the munchkin methods ? is it a direct call or a custom event trigger in a rule ? Is this method being called from the same rule that injects the munchkin script tag on pageload? 

 

 

By the issue you are facing, I am assuming you have the script tag and the method call in the same Launch Rule. If that is the case, every time you call the munchkin methoda, the script tag would also get added to the page.

 

Separate the munchkin method calls from the initial script injection rule and have two rules. One rule to inject the script tag on initial pageload and one rule to call the munchkin methods on SPA pageview or interaction. That should solve your issue.

 

Hope the above would help. If there is a different setup than the above, let us know.


Cheers,

Abhinav

1 reply

abhinavbalooni
Community Advisor
abhinavbalooniCommunity AdvisorAccepted solution
Community Advisor
December 21, 2023

Hey @krishnava 

 

How are you calling the munchkin methods ? is it a direct call or a custom event trigger in a rule ? Is this method being called from the same rule that injects the munchkin script tag on pageload? 

 

 

By the issue you are facing, I am assuming you have the script tag and the method call in the same Launch Rule. If that is the case, every time you call the munchkin methoda, the script tag would also get added to the page.

 

Separate the munchkin method calls from the initial script injection rule and have two rules. One rule to inject the script tag on initial pageload and one rule to call the munchkin methods on SPA pageview or interaction. That should solve your issue.

 

Hope the above would help. If there is a different setup than the above, let us know.


Cheers,

Abhinav

krishnavaAuthor
January 2, 2024

Hey @abhinavbalooni 

 

Thanks Reply, I have created two rules as you said, but the behavior is still same.

abhinavbalooni
Community Advisor
Community Advisor
January 3, 2024

Hey @krishnava 

Can you share the code deployed through the two rules and also the events that trigger the rules.