Marketo Munchkin Tracking Issue - New Token ID Generated on Page Reload in Headless CMS | Community
Skip to main content
Level 1
January 16, 2025
Solved

Marketo Munchkin Tracking Issue - New Token ID Generated on Page Reload in Headless CMS

  • January 16, 2025
  • 1 reply
  • 1880 views

Hi there, 

 

I'm seeking assistance with a Marketo Munchkin tracking implementation issue. We're implementing Marketo tracking in our new headless CMS environment:

 

Environment:

  • Headless CMS built in Optimizely
  • Next.js framework
  • Marketo Munchkin implementation (via GTM and hardcoded - both tested)

 

Issue: We're experiencing problems with the _mkto_trk cookie. Every page reload or form submit is being tracked as a new visitor due to an unique token ID. Resulting in an incorrectly tracking for returning visitors and form submitters by a refresh of the _mkto_trk cookie. As the website is Headless we're aware that every pageview needs to be tracked separately via a HistoryChange event, so navigation through the website works as intended.

 

Could you please advise on the correct implementation approach for our headless architecture or suggest potential solutions to maintain consistent visitor tracking?

 

Thank you for your help.

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 SanfordWhiteman

You can solve it right now by setting domainLevel:

 

Munchkin.init("AAA-BBB-CCC", { domainLevel: 3 } );

Set it to 2 or 3 based on the environment.

 

1 reply

SanfordWhiteman
Level 10
January 16, 2025
What is the actual domain you're using? This sounds like the behavior if you try to set the cookie at a public domain suffix. For example, if you're building on Netlify, you cannot set a cookie at netlify.app because even though that's technically a private domain, it's on the PSL and is treated as public.
StanSoAuthor
Level 1
January 16, 2025

@sanfordwhiteman 

Ah yeah, that's indeed my concern as well. We're running on a sub-domain of vercel.com/ where the test and staging environments are hosted at this moment. Do you think when we move to our own domain this issue can be solved?

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
January 16, 2025

You can solve it right now by setting domainLevel:

 

Munchkin.init("AAA-BBB-CCC", { domainLevel: 3 } );

Set it to 2 or 3 based on the environment.