18 Replies Latest reply on Oct 16, 2018 7:38 AM by Ana Gonzales

    Associating anonymous and known leads across different domains

      Hi there,

       

      We have a tricky issue linking our anonymous and known leads.

       

      There are 2 domains that our website traffic travels between, the website and the online booking portal, and the Munchkin script have been implemented across both domains. Visitors come in through the website (Marketo capture information on what source they came from), and are then referred to the online booking portal to get a quote. When they are on the online portal, they have to enter in their email address through ha non-Marketo form to obtain a quote and they can even book in their job. This information is fed into our custom CRM and synced into Marketo in real time.

       

      However, on our Marketo instance, it has been coming through as 2 separate leads. The visit to our website would have an anonymous lead created, tracking web page activity, how they got to the portal, how far they went onto getting a quote and booking in the job. The lead that’s synced into Marketo via the CRM containing the email address and quote information, comes in as a new lead, and won’t connect with the anonymous lead created. Therefore disabling us from associating webpage activity with booking activity, and calculating ROI.

       

      Our developer have assisted us by adding a script so when the email address is submitted and synced into Marketo, it will now also send the cookie value in a new Marketo Cookie field (e.g. id:561-HYG-937&token:_mch-marketo.com-1258067434006-50277).

       

      The anonymous and known leads are still not associating though. It feels like we’re missing a step because the Marketo Cookie field isn’t linked to anything in Marketo? Is there any solution to this issue...?

        • Re: Associating anonymous and known leads across different domains
          Sanford Whiteman

          You have the ingredients of a solution to this common problem, but you aren't putting them together. Having the cookie value stored on the lead is critical, but you also need to run a webhook to associate the lead with its cookie. Right now, the cookie is just any old field and has no inherent meaning.

            • Re: Associating anonymous and known leads across different domains

              Thanks Sanford for your reply. How do I run a webhook to connect these?

               

              I have tried setting a webhook up as per another post, exactly as the post suggest (below is exactly what is in our instance, except munchkin id replaced), but it's still not associating. Should we adjust the payload template or encoding...?

                • Re: Associating anonymous and known leads across different domains
                  Sanford Whiteman

                  https://eva-test.salmat.com.au/ldn/csetOnline.do times out, then redirects, for me.  Is it configured to only accept connections from Marketo IPs? What's the underlying code run by that webhook?

                    • Re: Associating anonymous and known leads across different domains

                      It is configured to accept Australian IPs I believe.

                       

                      What do you mean underlying code run by the webhook? This is how it's set up currently:

                        • Re: Associating anonymous and known leads across different domains
                          Sanford Whiteman

                          I mean the underlying code run by cSetOnline.do.  From the extension .do I gather that's a Java webapp.  You're feeding it all required information in the webhook template, but I couldn't possibly know if it's calling Marketo correctly (looks like a server-side form post, not an API per se) unless I saw the Java code.  It looks a little strange to me that the munchkinId is enclosed in parens and single quotes, but it's perfectly possible that the Java code strips those off appropriately before reposting to Marketo.

                           

                          You also don't need to bounce this particular request off an outside webhook server.  You can post directly to the /save endpoint: http://localhost/index.php/leadCapture/save. In that case you definitely do not want the munchkinId wrapped in anything, you want plain old munchkinId=AAA-BBB-CCC.

                            • Re: Associating anonymous and known leads across different domains

                              Thank Sanford!

                               

                              After editing the webhook, Marketo is now picking up web activity of the lead prior to filling out the form (on the online portal domain). Making the changes as per your suggestions did the trick:

                               

                              http://localhost/index.php/leadCapture/save

                               

                               

                              Email={{lead.Email Address}}&munchkinId=aaa-bbb-ccc&formid=1006&_mkt_trk={{lead.Marketo Cookie ID}}

                               

                               

                               

                              However, on the lead record, it's still missing activity from the website (previous domain) which is also tracked with the same Munchkin code.

                               

                              Are we missing another piece of the puzzle?

                                • Re: Associating anonymous and known leads across different domains
                                  Sanford Whiteman

                                  If it's the same cookie on both domains, then you aren't missing anything.  If it isn't working, it can't be the same cookie.

                                   

                                  You said your dev is supplying "the" cookie value along with the form.  How exactly is s/he transferring the cookie value from domain 1 to domain 2? Is s/he just supplying the the domain 2 cookie?  Obviously that alone won't work: when Munchkin doesn't see a cookie value either already in the browser or in its configuration options, it generates a new, random cookie. Since cookies are not automatically shared across domains, you have to use special code to make sure the existing cookie is in place before a new one is created. If the only way to get to domain 2 (at least the first time) is via domain 1, that's a good thing, because it means you can transfer the cookie easily.  If not, you need to put in more work.

                                   

                                  (It's funny how Mark Wallace is asking essentially the same question right now. I guess that proves what I meant about "common"! But it might be more accurately described as "not without precedent." )

                                    • Re: Associating anonymous and known leads across different domains

                                      Yes I believe they are sending through 2 separate leads as web activity on domain A remains with an anonymous lead and not linked with web activity on portal domain. In most of the cases the first time someone will go to portal domain is via domain A (unless they are opening a system non-Marketo quote email from a different device).

                                       

                                      By "special code" do you mean this one? Associate Lead » Marketo Developers Should I ask the developer to add this to the portal domain or both...?

                                        • Re: Associating anonymous and known leads across different domains
                                          Sanford Whiteman

                                          Yes I believe they are sending through 2 separate leads as web activity on domain A remains with an anonymous lead and not linked with web activity on portal domain. In most of the cases the first time someone will go to portal domain is via domain A (unless they are opening a system non-Marketo quote email from a different device).

                                          Well, if you're willing to ignore those cases where someone goes straight to domain B and make the decision to only push cookies that originate on domain A to domain B, your developer's job will be far easier.  Let's call this Option 1.

                                           

                                          It takes specialized skills to get this right if you're going to be pulling an existing cookie from domain A to domain B and/or pushing a cookie that originates on domain B to domain A. This is Option 2.  You need someone who is very savvy about the whole ecosystem including JS and Munchkin.

                                           

                                          By "special code" do you mean this one? Associate Lead » Marketo Developers Should I ask the developer to add this to the portal domain or both...?

                                          No, that REST method isn't going to help.  It'll amount to merely a less scalable form of the webhook you've already got and it should not be used from the browser.

                                           

                                          To implement Option 1, as I alluded to in my earlier replies to Greg, you only need to make sure that all links that leave domain A for domain B are decorated in some way with the cookie value.  This can mean changing those links to actually be POSTs to domain B instead of GETs and passing the value in the request body (debatably the best method because the value doesn't appear in the URL at all, but it will require server work); or changing the links to pass the value in the query string or #hash, then reading and removing the value using JavaScript (this method doesn't require any changes to code on the portal server).

                                            • Re: Associating anonymous and known leads across different domains

                                              Hi Sanford,

                                               

                                              Unfortunately we still can't seem to get it working... my developer added this code to Domain A:

                                               

                                              <script>

                                              $( document ).ready(function() {

                                                //Get all links from the page

                                              $('a').each(function() {

                                                //Get the exist URL

                                              var existUrl = $(this).attr('href');

                                              if(existUrl == 'https://Domain B'){

                                              //Change the existing URL to new one

                                              $(this).attr('href', 'https://Domain B&munchkinCookie=cookieValue');

                                              }

                                                });

                                              });

                                              </script>

                                               

                                              But I'm not sure this is correct for picking up the cookie value, because there are two instances of Marketo Munchkins on Domain A (one for prod and the other for test), and this code doesn't specify which one it should pick up...

                                               

                                              We currently have cross domain tracking working for Google analytics set up by a previous employee so all links leaving Domain A to Domain B is tagged like https://Domain B?_ga=1.0000000.0000000000.0000000000 so it is do-able but I just don't have access to that person to see how it was done.

                            • Re: Associating anonymous and known leads across different domains
                              Grégoire Michel

                              Hi Chloe,

                               

                              Just remember one thing : reading a cookie from domain A when the lead is navigating in domain B is considered as a Cross-Scripting (XSS) technique and is considered as extremely bad practices, if not illegal,  in many countries even if the 2 domains belong to the same company.

                               

                              At some point, development is not everything. You may need to have people to fill out a form in each domain, so that Marketo can automatically merge the 2 leads based on email address. In order to create a Marketo LP in a second domain, you can use domain aliases (Add Additional Landing Page CNAMEs - Marketo Docs - Product Docs )

                               

                              There is a lot said here as well : Comprehensive Multi-Domain management

                               

                              -Greg

                                • Re: Associating anonymous and known leads across different domains
                                  Sanford Whiteman

                                  Just remember one thing : reading a cookie from domain A when the lead is navigating in domain B is considered as a Cross-Scripting (XSS) technique

                                   

                                  Reading a first-party cookie is not illegal in any country. At no time are you reading a third-party cookie, which is technically impossible in all modern browsers.

                                   

                                  Note that every single Munchkin hit and Marketo form post transport a first-party cookie from your domain to Marketo's domain.

                                   

                                  Compliance with EU cookie law is ensured by prompting for consent on any main document regardless of shared data control. This is not mutually exclusive with transporting cookie values.  It means that the person needs to consent on domain A and on domain B.

                                   

                                  Believe me when I say that working in a highly regulated international financial company, we have vetted cookie policies.

                                   

                                  At some point, development is not everything. You may need to have people to fill out a form in each domain, so that Marketo can automatically merge the 2 leads based on email address.

                                   

                                  No, custom development fixes this problem just fine.

                                    • Re: Associating anonymous and known leads across different domains
                                      Grégoire Michel

                                      Hi Sanford,

                                       

                                      I understand here that the issue is that, as the web site and the portal are on separate domains, the need it to have the Marketo known lead reconciled to 2 cookies (the website one and the portal one).

                                       

                                      I understand that :

                                      • if, when on the portal, you read the cookie from the portal domain and send it to the CRM, that is fine indeed. From that, you can trigger a webhook to reconcile the portal cookie with the know lead.
                                      • Sending the website cookie value to the portal through an URL parameter then storing this cookie value in a field, then triggering the webhook would of course work as well. You might not be reaching a 100% reconciliation, though, as some people may come back later directly on the portal URL and the URL parameters would be missing the cookie value in this case, or worse, have a wrong cookie value, if people send their URL to someone else.
                                      • If you want to reconcile both the website cookie and the portal cookie, which what is intended here, you will have to combine the 2 approaches above. This means that you will have to store the 2 cookies (the one from the portal, the one collected from the URL parameter) in 2 separate fields and call the webhook twice (or create a webhook that can handle 2 cookies).

                                       

                                      I just wanted to point out that reading the website cookie from the portal is invalid, because they are separate domains.

                                       

                                      -Greg

                                        • Re: Associating anonymous and known leads across different domains
                                          Sanford Whiteman

                                          Reading the cookie values *as cookies* cross-domain -- that is, peeking into the browser's cookie database directly -- is expected to be impossible. This restriction is enforced by the browser itself. To attempt to circumvent it means exploiting unfixed browser bugs or vulnerable plugins, so it's obviously unethical, not to mention unreliable.

                                           

                                          But this really has nothing to do with how you properly transmit cookie values *as strings* across domains. There are numerous technologies that allow sharing text values this way, all of them perfectly legal and technically reliable. No webhooks required.

                                          1 of 1 people found this helpful
                                          • Re: Associating anonymous and known leads across different domains
                                            Sanford Whiteman
                                            • have a wrong cookie value, if people send their URL to someone else.

                                             

                                            That's why, if you were choosing this method, you either use a POST (like Marketo does to share session cookies); GET and redirect the user to a page without the query param; or replace the querystring or hash using JavaScript immediately when the page renders.

                                             

                                            • If you want to reconcile both the website cookie and the portal cookie, which what is intended here, you will have to combine the 2 approaches above. This means that you will have to store the 2 cookies (the one from the portal, the one collected from the URL parameter) in 2 separate fields and call the webhook twice (or create a webhook that can handle 2 cookies).

                                             

                                            You have to transmit the cookie values as strings across domains.

                                        • Re: Associating anonymous and known leads across different domains
                                          Sanford Whiteman

                                          Also note: whenever you switch from the Marketo Admin UI to the Marketo Designer (two different domains) your session cookie is transported cross-domain using HTTP POST.   I have no problem with that as it's one of several common solutions. I have a feeling you're not aware of how often you and the sites you use are actually using such methods!