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?
Solved! Go to Solution.
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.
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.
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.
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).
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.)
Right, you don't want to touch any of the internal string at all.