Multiple munchkin inits - recovering historical web activity

Not applicable

Multiple munchkin inits - recovering historical web activity

When building one of our landing page templates, our developer accidentally included the munchkin code for another page in the code (we assume it was a "View Source" and then copy/paste from another template).

As a result, two munchkin definitions were appearing on all of our landing pages built on this template, e.g.:

<script type="text/javascript" src="//"></script>

<script>Munchkin.init('000-AAA-000', {customName: 'copied-name', wsInfo: 'ABCD'});</script>

<script type="text/javascript" src="//"></script>

<script>Munchkin.init('000-AAA-000', {customName: 'generated-name', wsInfo: 'ABCD'});</script>

(the one in the template, and the one automatically inserted by Marketo)

When building reports on the landing pages (page views and link clicks specifically) we noticed no data was coming through.  Upon testing, we also noticed no web activity for these pages was appearing on an individual leads activity log.

After removing the duplicate munchkin code from the template everything jumped back to life for new data, but we also noticed users revising the page (with an active session/cookie) seemed to restore some of their historical data from when there were two codes in place.

So, is there a way of include all of the historical data from when two codes were in place in our reports?  Is there a way I can filter based on the custom name that was in place before, and then relating to the landing page it was included on?

Tags (1)
Level 10 - Community Moderator

Re: Multiple munchkin inits - recovering historical web activity

First, to be clear, there's never a time when Munchkin.init "runs" twice in practice. init has run-once protection: it exits immediately if it's already run.*

Since all 4 of your scripts run synchronously, the init for "generated-name" one never runs because the "copied-name" one has always run first.

So, in practice, for as long as you had both of the embed codes in place, you were:

  • creating a new Munchkin cookie (which is not linked to custom info at all, and will be reused) or using an existing cookie
  • sending a Visit Web Page event with invalid custom metadata for that page

Historical Visit Web Page activities from when the embed code was correct, but the session was not yet associated (anonymous) will be merged into the known lead. You can't recover the VWP activities that contained invalid information.

* Yes, technically that means the function is entered each time, but as far as side effects it's run-once.