Skip to main content
Igor_Tosic
Level 2
March 8, 2018
Question

Marketo tracking cookie

  • March 8, 2018
  • 1 reply
  • 7485 views

Hi, I would like to use code snippet for clearing Marketo tracking cookie from forms submission( form.addHiddenFields({"_mkt_trk":""});). I am wondering is it possible to use it as if condition, for example, if you don't checkbox in form than disable tracking. And all this is related to landing pages, I want to do this on a landing page in Marketo, not in an embed code which you usually copy from Form Actions.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
March 8, 2018

You certainly can make removing the cookie conditional:

if (form.getValues().trackMe == "no") {

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

}

But be careful, you're not honoring the user's no-track status by doing only this. Their session will still be associated if they click a tracked and mkt_tok-enized email link, for example.

Igor_Tosic
Level 2
March 13, 2018

Hi, this looks great, I'll use it in some way. I am the beginner in Marketo, so I will explain my instance a little bit more: When I checkbox, form expands. And you get new checkbox and few drop-down fields also with the checkbox. So the first checkbox is optional and if you don't check it I want to clear tracking. Also, I am wondering, where should I put this code snippet - in <head> of my site or somewhere in Marketo when I create Form?

SanfordWhiteman
Level 10
March 13, 2018

So the first checkbox is optional and if you don't check it I want to clear tracking.

That's fine, but what I'm explaining is if you promise people "We will not track you" then merely removing the cookie from form submission does not meet that promise. If you later send that person a Marketo email with a tracked and mkt_tok-enized link (the default kind of link) you will end up associating their previously anonymous cookie and tracking their web activities. 

That's what Marketo-wrapped links are all about: they're a substitute for a form fillout when the email was already sent to a known person.  So if you're going to be honest/legal you can't just turn off one way you might track them, you have to turn off all ways you track them.

Here's what removing the cookie at form submission promises: that you will not change the current associated/anonymous status of their cookie.  It won't un-associate a previously associated cookie, and it won't delete the cookie. It will just leave it alone.

The only way to fully disable tracking for a person is:

  • delete all existing Munchkin cookies they have
  • never reinitialize Munchkin (Munchkin.init), since that will create a new cookie that could be associated
  • do not send tracked links to a person you already know has opted out of tracking
  • observe these policies on all devices and browsers known to be operated by the person

A couple of these steps may be redundant depending on your workflow, but it does not hurt to make sure you're obeying the law.

Also, I am wondering, where should I put this code snippet - in <head> of my site or somewhere in Marketo when I create Form?

Don't put it on your form (in Form Editor) because you'll end up losing track of it. Put it as an inline <script> in your template(s), or better yet, host it via a remote <script> on another server so you can more easily tweak it without having to reapprove all your LPs.