Skip to main content
Casey_Grimes2
Level 10
Aug 5, 2016 3:23 PM UTC
Solved

Using cookie replication with Munchkin for consistent sessions?

So, I'm well-aware of what's on this particular Marketo Developers blog entry, but I'm a little stumped on something I'm trying to achieve.

Right now, I have several different domains tied to one Marketo instance. Now, I know when a visitor goes to each website that Marketo is going to write domain-specific cookies for each site—but I'm attempting to route around this by having the server write _mkto_trk values for every website in its own domain-specific cookie once a first visit has been logged on any of those domains. I'd like the session to carry between each domain, so would writing values like

oranges.com: id:123-ABC-456&token_mch-oranges.com-1234567890123-45678

apples.com: id:123-ABC-456&token_mch-apples.com-1234567890123-45678

Alternately, would using a "group" domain (e.g., populating fruitsalad.com across all domains rather than change things) consistently across all domain cookies solve the issue?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
User Group Leader
Aug 5, 2016 7:29 PM UTC

If you have an existing (first-party) cookie that doesn't match the default Munchkin pattern, but you want to use it as the cookie for a session, pass the visitorToken arg. For example, if you're on apples.com but you have an associated cookie from oranges.com:

Munchkin.init('AAA-BBB-CCC',{ visitorToken: 'oranges.com: id:123-ABC-456&token_mch-oranges.com-1234567890123-45678' });

Typically, of course you wouldn't have a constant string, unless you were outputting it server-side.

5 replies

SanfordWhiteman
User Group Leader
SanfordWhitemanUser Group LeaderAccepted solution
User Group Leader
Aug 5, 2016 7:29 PM UTC

If you have an existing (first-party) cookie that doesn't match the default Munchkin pattern, but you want to use it as the cookie for a session, pass the visitorToken arg. For example, if you're on apples.com but you have an associated cookie from oranges.com:

Munchkin.init('AAA-BBB-CCC',{ visitorToken: 'oranges.com: id:123-ABC-456&token_mch-oranges.com-1234567890123-45678' });

Typically, of course you wouldn't have a constant string, unless you were outputting it server-side.

Translate
Casey_Grimes2
Level 10
Aug 5, 2016 8:41 PM UTC

So the trick is to keep the domain consistent even when you're writing to separate domains? If that's the case, that actually makes things much easier.

Also, someone should seriously have documented visitorToken on Munchkin Initialization Parameters. Ugh.

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Aug 5, 2016 8:56 PM UTC

Well, that's not the only trick.  You still have to transport the same cookie across domains, which a browser won't do!  I figured you were using some back-end method to do that (such as having people authenticate).

Translate