SOLVED

Help with Leads that are cookied that are bypassing our custom duplication rule

Go to solution
jsnow
Level 2

Help with Leads that are cookied that are bypassing our custom duplication rule

Hello all,

I am having an issue and was hoping someone here might have an idea or solution to resolve what we are running into. We have custom duplication rules in place where if a net new lead fills out a form with one company "mkto PortCo Most Recent" and then that same person fills out a different form for a different company, that it creates a duplicate lead rather than update the existing record. For example, if someone fills out a "Company X" form and then later fills out a "Company Y" form, it should create a lead for the person with both companies rather than update the company from "Company X" to "Company Y". 

We have a .js code that was supposed to help solve this issue. We had a member of our team place this on the back-end of a testing form/landing page. This .js clears the Mkto tracking cookie upon submission of the form, if the pixel was causing the issue a quick test of multiple submissions using the same email but different companies (mkto portco most recent) would create duplicates as per our custom deduplication rules, however I tested this on our test submission page that we use similar to how a tradeshow form would be used and it did not create a duplicate and instead updated the marketo record.  My expected result is that the marketo cookie would be cleared from the _mkt_trk hidden value and a duplicate would be created for the ‘mkto portco most recent’ submissions.

You can see that the form submission simply updated the mkto portco most recent rather than creating a duplicate


jsnow_0-1666626996896.png

This is the code we used and was placed on that test landing page.

 

<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>

 


Any help or suggestions that you can think of would be greatly appreciated! Please note that we tried testing the form with and without the .js code and got the same results both times of it not working.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Help with Leads that are cookied that are bypassing our custom duplication rule


Like I mentioned, I tried testing this with the code in the header and the place you suggested yesterday, and it still gave me the same result which was a failed test where it just updated mkto PortCo Most Recent field instead of creating a net new lead.

Well, if it’s in the <head>, the code throws an error instantly because the forms library doesn’t exist yet. So that’s not really a fair comparison. Only when the code is actually running in full can you decide whether it fills your needs or not.

 

It sounds to me like you need to remove the mkt_tok as well. Use this code instead:

MktoForms2.whenReady(function (form) {
   form.addHiddenFields({ 
      _mkt_trk: "",
      mkt_tok: ""
   });
   
   form.onSubmit(function (form) {
      form.vals({ 
         _mkt_trk: "",
         mkt_tok: ""
      });
   });
});

View solution in original post

13 REPLIES 13
SanfordWhiteman
Level 10 - Community Moderator

Re: Help with Leads that are cookied that are bypassing our custom duplication rule

Can you link to the page with this code to make sure it was deployed correctly?

jsnow
Level 2

Re: Help with Leads that are cookied that are bypassing our custom duplication rule

Are you asking for the url of the landing page with the test form on it? If so, here you go: 
https://staging-t360payments.kinsta.cloud/partner-with-us/mkto-form-test/

SanfordWhiteman
Level 10 - Community Moderator

Re: Help with Leads that are cookied that are bypassing our custom duplication rule

SanfordWhiteman_0-1666640996560.png

 

Line 84:

SanfordWhiteman_1-1666641018717.png

 

You’d kind of hope your developers would’ve noticed this. 😐

 

P.S. The comment “add a callback to the first ready form” is incorrect, the whenReady callback fires for all forms unless you deliberately check if it’s already fired (don’t know why you’d do this).

jsnow
Level 2

Re: Help with Leads that are cookied that are bypassing our custom duplication rule

Ok thank you for the call-out. Are you able to tell me what it needs to be updated to in the part you referenced that is the issue, so that we can place the updated .js code on our test page and I can ensure that this will work as we are hoping?

SanfordWhiteman
Level 10 - Community Moderator

Re: Help with Leads that are cookied that are bypassing our custom duplication rule


Ok thank you for the call-out. Are you able to tell me what it needs to be updated to in the part you referenced that is the issue, so that we can place the updated .js code on our test page and I can ensure that this will work as we are hoping?

The code depends on the global MktoForms2 object (i.e. the core forms library) so it needs to come after the <script> that loads forms2.min.js.

jsnow
Level 2

Re: Help with Leads that are cookied that are bypassing our custom duplication rule

So we actually had it placed there first and it didn't work there either. I tried running the test with it there first and it still didn't create the new lead as we expected, so our dev person tried putting the code in the header of the page and I tried testing it again. Our dev person has since updated the page, so it should be back in the correct place, where you suggested it needs to be. That being said, is there anything else you can see that would be causing this issue or anything else we can update in the code or anything else to try to get this to work?

jsnow
Level 2

Re: Help with Leads that are cookied that are bypassing our custom duplication rule

Just as a follow-up to this, these are the steps I took to do the test. Is it possibly an issue with one of the steps in our test or do you think it's something in the code? Like I mentioned, I tried testing this with the code in the header and the place you suggested yesterday, and it still gave me the same result which was a failed test where it just updated mkto PortCo Most Recent field instead of creating a net new lead. See below:

Set new marketo cookie:

1. Clear your cookies on your browser
2. Go to autoshop solutions and navigate to multiple pages (ie. 3 separate pages)
3. Navigate to the Schedule a Demo form
4. Fill out the form with a valid email that you have access to and submit
5. Check MKTO and Salesforce to ensure lead came in, in Salesforce ensure that the page data shows on Marketo Sales Insights


Create 360P test email:

1. Create a test email send that includes a link to this test page (https://staging-t360payments.kinsta.cloud/partner-with-us/mkto-form-test/) and ensure this has all the link tracking enabled
2. Add the test lead you created in “Set new marketo cookie” testing section to the list for the test send
3. Send the email to the valid email you submitted in the “set new marketo cookie” section
4. Once the email is received click on the 360P link
5. Fill out the form on the 360P test page using the same data from your test lead in “set new marketo cookie” section
6. Verify that the lead submitted on the 360P test page created a net new lead for 360P

Expected result is that a net new lead for 360P will be created. A failed test is if the 360P test lead merged with the ASi lead created in “set new marketo cookie” section.

SanfordWhiteman
Level 10 - Community Moderator

Re: Help with Leads that are cookied that are bypassing our custom duplication rule


Like I mentioned, I tried testing this with the code in the header and the place you suggested yesterday, and it still gave me the same result which was a failed test where it just updated mkto PortCo Most Recent field instead of creating a net new lead.

Well, if it’s in the <head>, the code throws an error instantly because the forms library doesn’t exist yet. So that’s not really a fair comparison. Only when the code is actually running in full can you decide whether it fills your needs or not.

 

It sounds to me like you need to remove the mkt_tok as well. Use this code instead:

MktoForms2.whenReady(function (form) {
   form.addHiddenFields({ 
      _mkt_trk: "",
      mkt_tok: ""
   });
   
   form.onSubmit(function (form) {
      form.vals({ 
         _mkt_trk: "",
         mkt_tok: ""
      });
   });
});
jsnow
Level 2

Re: Help with Leads that are cookied that are bypassing our custom duplication rule

I had my developer place that code you gave me yesterday on the back-end of that test page and I ran through the test this morning and it worked! It created a net new lead for 360 Payments instead of just updating the mkto PortCo Most Recent on the existing Autoshop Solutions lead like it had done with all my previous tests. Thank you so much for all your help on this!! Really appreciate it.