SOLVED

Re: Using cookie replication with Munchkin for consistent sessions?

Go to solution
Casey_Grimes
Level 10

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?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Using cookie replication with Munchkin for consistent sessions?

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.

View solution in original post

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Using cookie replication with Munchkin for consistent sessions?

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.

Casey_Grimes
Level 10

Re: Using cookie replication with Munchkin for consistent sessions?

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.

SanfordWhiteman
Level 10 - Community Moderator

Re: Using cookie replication with Munchkin for consistent sessions?

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).

Casey_Grimes
Level 10

Re: Using cookie replication with Munchkin for consistent sessions?

Still using a backend method for assigning all values—I guess I was just curious to know whether the entire string represented the visitor token or just the trailing digits + instance identifier (and upon further testing it does look like the entire visitor token needs to be used without switching the domain name in it.)

SanfordWhiteman
Level 10 - Community Moderator

Re: Using cookie replication with Munchkin for consistent sessions?

Right, you don't want to touch any of the internal string at all.