Delete cookie on form fill | Community
Skip to main content
Oz_Platero
New Participant
August 11, 2021
Solved

Delete cookie on form fill

  • August 11, 2021
  • 1 reply
  • 2869 views

Hello Community,

 

I am in need of building a partner/referral page.  Some requisites needed

  • Disable web page visit tracking
    • Addressed on Landing Page template
      • Form page, and Follow up page
      • Working as intended
  • Delete cookie on form fill
    • Found an article in Marketo Dev pages. See Resources #1
    • Does not seem to be working. When I access the dev console on Follow up page the _mkto_trk attribute in the cookie still has a value in it.
    • I go back to the page with the form and resubmit to double check and the _mkto_trk attribute remains unchanged.

 

Resources

  1. https://developers.marketo.com/blog/clearing-marketo-tracking-cookie-from-forms-2-0-submission/
  2. Form page:
    1. noMunchkkinPage1.html
  3. Follow up page
    1. typage1-noMunchkin.html 
  4. Dev console on TY page
    1. document.cookie  -> "_mkto_trk=id:103-OIG-576&token:_mch-marketo.com-1111111111111-11111;
    2. (I changed the numbers to all 1's in the _mch-marketo.com)

 

Thanks

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

On a referral form, you don’t have to actually remove the cookie from the browser’s cookie store.

 

In fact, you specifically don’t want to remove the cookie permanently, because the person filling out the form (the referrer) is also a lead in your db, and their own activity is still interesting. What you want to do is make sure the referral lead‘s record doesn’t take over the session.

 

So you have to remove the cookie from the form post, which is what the code in that blog post is designed to do. Taking advantage of a known quirk in the forms library, it empties the hidden field that normally holds the cookie when the form is submitted; the cookie in the browser isn’t touched.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
August 12, 2021

On a referral form, you don’t have to actually remove the cookie from the browser’s cookie store.

 

In fact, you specifically don’t want to remove the cookie permanently, because the person filling out the form (the referrer) is also a lead in your db, and their own activity is still interesting. What you want to do is make sure the referral lead‘s record doesn’t take over the session.

 

So you have to remove the cookie from the form post, which is what the code in that blog post is designed to do. Taking advantage of a known quirk in the forms library, it empties the hidden field that normally holds the cookie when the form is submitted; the cookie in the browser isn’t touched.

Oz_Platero
New Participant
August 12, 2021

@sanfordwhiteman 

Thanks.