Non-trackable landing page is still identifying me

Dan_Stevens_
Level 10 - Champion Alumni

I've build a non-trackable landing page template that includes the following code:

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

  <script>document.cookie = "_mkto_trk=;path=/;domain="+window.location.host+";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

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> 

<!-- END -->

I then use this template to build a landing page with a form where no tracking or identification should occur (this page will be used internally to approve/deny event registrants).  Yet when I visit the page, all of the pre-fill fields are auto-populated with my name.  Am I forgetting another piece of code?

26 REPLIES 26
Grégoire_Miche2
Level 10

Thx Dan,

I still have a error in the code on the "MktoForms2.whenReady( function(form)" line : Uncaught ReferenceError : MktoForms2 is not defined.

I m using a guide LP. The page is here : inficiences

Thx for any help 🙂

-Greg

Dan_Stevens_
Level 10 - Champion Alumni

Now that I look more closely at our pages, we're getting the same error.  This is the standard code that both Sanford Whiteman​ and Kenny Elkington​ have shared.

SanfordWhiteman
Level 10 - Community Moderator

window.location.host is the FQHN of the current page that appears in your browser's location bar.

In other words, for the Community site, nation.marketo.com.  You want to clear cookies that apply to the parent and all subdomains: .marketo,com.

Dan_Stevens_
Level 10 - Champion Alumni

I'm not sure I'm following exactly.  Here's the landing page:

https://pages.avanade.com/Template---Roadshow---Head-Space-Event-Approval_approved.html?EmailAddress...

What changes are needed in the above code?

SanfordWhiteman
Level 10 - Community Moderator

Can't see the source from my mobile, but you probably want to replace

document.location.host

with

'.avanade.com'

Note that the quotation marks _are_ included.

Dan_Stevens_
Level 10 - Champion Alumni

That fixed it, Sanford, thanks!