2 Replies Latest reply on Dec 9, 2013 2:19 PM by 27185

    How to share munchkin cookie between different domains

      I am working on an implementation that requires a Marketo landing page to be displayed in an iframe, and I'm having trouble getting the munchkin cookies to be shared between the parent page and the iframe, which are currently on different domains.

      Digging through the source of munchkin,js, I found the 'domainLevel' option, which looks like it should address this issue.

      I'm calling `Munchkin.init` in the parent page using the top-level domain that my landing page iframe is on, like this:

          Munchkin.init('123-XYZ-456', { domainLevel: 'mysite.com' });

      But still I seem to be getting separate _mkto_trk munchkin cookies set for the page (which is on localhost) and the iframe (which is on mysite.com).

      id:123-XYZ-456&token:_mch-mysite.com-1386621407738-26687
      id:123-XYZ-456&token:_mch-localhost-1386613970530-65372
      It seems that something must be wrong with the way I'm calling Munchkin.init, but I can't find any examples in the documentation of how it should be called to share cookies between different top-level domains. Can anyone point me to a working example of this?
        • Re: How to share munchkin cookie between different domains
               Leads created in one domain remain anonymous in another until users nurture the lead under each domain, send emails with tracked links to each domain, the activity will be tied together under that lead and automatically merged.
                
               By default, the session ID cookie domain is set to the hostname you're accessing. For example, if you access the catalog using server myhost.mydomain.local, then cookie will be set by myhost.mydomain.local. 
                
                
               The same principle applies to browsers: a cookie is browser-specific. Even though users may have been cookied, say, using Safari, if they start a new session using Chrome a new cookie will be set, starting a new anonymous lead that will not be merged with the previous one created for Safari. 
                
                
               Although there is the RFC 2965 http://tools.ietf.org/html/rfc2965 (Set-Cookie2, had already obsoleted RFC 2109) that should define the cookie nowadays, most browsers don’t fully support that but just comply to the original specification by Netscape. 
                
                
               There is a distinction between the Domain attribute value and the effective domain: the former is taken from the Set-Cookie header field and the latter is the interpretation of that attribute value. According to the RFC 2965, the following should apply: 
                
                
               If the Set-Cookie header field does not have a Domain attribute, the effective domain is the domain of the request. 
               If there is a Domain attribute present, its value will be used as effective domain (if the value does not start with a . it will be added by the client). 
                
                
               CookieDomain accepts a space-separated list of domains to set cookies for, in which case the Set-Cookie: ... is sent to the client for each of the specified domains. Due to the cookie restrictions described in the section called “NOTES”, specifying multiple domains is only rarely (if ever?) needed and possible to implement. 
                
                
                
                
               There are a number of different approaches you can consider: 
                
               Managing Multiple Domains and Microsites 
                
                
               Munchkin Overview 
                
          • Re: How to share munchkin cookie between different domains
            Thanks. I guess that makes sense. I didn't know if there was some kind of behind-the-scenes magic going on to associate cookies set to different domains; I saw that there were calls to a central Marketo domain (as set by the notifyPrefix) and I thought that might be being used to merge cookies.

            So it seem like the best approach for me to take is using the Munchkin.associateLead() function to manually correlate the cookie beween the two domains. I think that gathering the user record inside the landing page iframe, then passing that to the parent page and using it to call associateLead, should do the trick.

            FYI, the link you posted above for "Managing Multiple Domains and Microsites" doesn't resolve.