12 Replies Latest reply on Mar 23, 2017 12:51 PM by Sanford Whiteman

    Create a LP that clears you Cookie!

    Diederik Martens

      Even though we inform our colleagues, somehow some still fill out a form on someone's behalf or click a link in a forwarded email. I'm thinking about creating a blank landing page that clears the current Marketo cookie on visit (obviously with noindex, nofollow, etc). And then have that secret landing page set as homepage for sales reps and marketers. This way we prevent rogue behavior (page vists, etc) on a lead, whilst it actually was a sales rep accidentely tagged as the lead.

       

      I'm thinking about a few ways of achieving this, but maybe someone already cracked this ;-) Maybe just a simple line of code that sets the date of the Marketo cookie in the past. But then I do need to know how to reference it. Any ideas?

        • Re: Create a LP that clears you Cookie!
          Grégoire Michel

          Hi Diederik Martens ,

           

          Indeed

           

          1. Create a LP TEMPLATE that does not have the munchkin (this is done in editing the template and hitting the following menu:
          2. Add to you template a couple of JS that will clear cookies and prevent them from being posted to Marketo on form submit:

          <!-- CREATE EMPTY MUNCHKIN COOKIE - TO ESENTIALLY MAKE THE PAGE UNTRACKABLE -->

            <script>document.cookie = "_mkto_trk=;path=/;domain="+".inficiences.com"+";expires=0"</script>

          <!-- END -->

           

          <!-- Clear the Marketo tracking cookie value on submission of the form, without having to delete the cookie itself from the user’s browser. -->

            <script>

            //add a callback to the first ready form on the page

              $(function() {

                MktoForms2.whenReady( function(form){

                //add the tracking field to be submitted

                  form.addHiddenFields({"_mkt_trk":""});

                  //clear the value during the onSubmit event to prevent tracking association

                  form.onSubmit( function(form){

                  form.vals({"_mkt_trk":""});

                })

              })

            })

            </script>

           

          -Greg

          1 of 1 people found this helpful
          • Re: Create a LP that clears you Cookie!
            Diederik Martens

            Thank you Grégoire and Sanford

             

            I'm not about the form part, as there won't be any. Wouldn't the first line be enough, on a none-tracking-page, to clear the cookie for the specific domain (e.g. main website):

             

            <script>document.cookie = "_mkto_trk=;path=/;domain="+".examplesite.com"+";expires=Thu, 01 Jan 1970 00:00:00 UTC"</script>

             

            And add such a line for each (sub)domain that you're tracking. Then just visiting that page with the script would clear all Marketo cookies a sales rep might have?

             

             

              • Re: Create a LP that clears you Cookie!
                Sanford Whiteman
                <script>document.cookie = "_mkto_trk=;path=/;domain="+".examplesite.com"+";expires=Thu, 01 Jan 1970 00:00:00 UTC"</script>

                 

                And add such a line for each (sub)domain that you're tracking.

                 

                Yes, though I wouldn't duplicate the code but iterate a collection:

                 

                ['.example.com','.example.net','.example.org'].forEach(function(domain){ 
                  document.cookie = '_mkto_trk=;path=/;domain=' + domain + ';expires=Thu, 01 Jan 1970 00:00:00 UTC';
                });
                
              • Re: Create a LP that clears you Cookie!
                Courtney Grimes

                This actually brings up an interesting thought: would it be possible to alter munchkin.js using something like l2 or ipify to check if the public IP is associated with the Marketo instance's employees' IP and then have it disregard any mkt_trk parameters sent over URL to update the tracking cookie? The documentation on createTrackingCookie isn't clear on whether it also does the overwrite when mkt_trk is passed via parameter, but my educated guess is that setting that to false would block the update.

                 

                Obviously this would cause some issues for internal testing, but putting that aside (and assuming there'd be a way around that, like having a proxy just for testing) would such a solution work? This is a common source of confusion within companies.

                1 of 1 people found this helpful
                  • Re: Create a LP that clears you Cookie!
                    Sanford Whiteman

                    Sure, but you don't need to change how Munchkin behaves, just wrap it in a condition, e.g.

                     

                    <script>
                    function conditionalMunch(ipifyResult) {
                            var allowedPatterns = [
                                '1.2.3.*',
                                '108.12.130.200',
                            ];
                    
                            var ip = ipifyResult.ip,
                                isAllowed = allowedPatterns
                                .map(function(pattern) {
                                    return new RegExp('^' + pattern.replace(/(\.)/g, '\\$1').replace(/(\*)/g, '\\d{1,3}') + '$');
                                })
                                .some(function(rePattern) {
                                        return rePattern.test(ip);               
                                });
                    
                        if (isAllowed) Munchkin.init('410-XOR-673');
                    }
                    </script>
                    <script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=conditionalMunch"></script>
                    

                     

                    That wildcard pattern matching is quite naive but should do the trick.