Expand my Community achievements bar.

SOLVED

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

Avatar

Level 1

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

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

Avatar

Level 1

Hey @abhinavbalooni 

 

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

Avatar

Community Advisor

Hey @krishnava 

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