Re: Lead and Company token values not showing up in URL parameter links

Hoi_Nguyen3
Level 2

Lead and Company token values not showing up in URL parameter links

Hi Community,

I am building a customer referral program, where a customer can submit a Marketo form with their referral's details. For example, there is an existing record/customer in Marketo who is owned by our CSM Becky Smith and that record's name is John Doe from Test Company and his email address is john.doe@test.com and he wants to refer his colleague Will Smith from Men in Black.

John hits the landing page with a form that asks for Will Smith's details, e.g. First Name, Last Name, Company Name, and Email Address. Upon submission, a record is created for Will Smith from Men in Black at will.smith@test.com.

In addition to First Name, Last Name, Company Name, and Email Address on Will's record, we want to pass through the following fields to his record:

Referrer Name: John Doe

Referrer Company: Test Company

Referrer Email Address: john.doe@test.com

Referrer's Account Owner's Email Address: becky.smith@csm.com

In order to do so, I have set set up the form to populate the hidden fields via URL parameter below:

[URL Parameter = Field]

refname = Referrer Name

refcompany = Referrer Company

refemail = Referrer Email Address

csmemail = Account Owner Email Address

Additionally, in the email that I send to John Doe, I include the following link to the landing page and form:

https://go.greenhouse.io/customer-referral-OPEN-promo.html?refname={{lead.Full Name}}&refcompany={{company.Company Name}}&refemail={{lead.Email Address}}&csmemail={{company.Account Owner Email Address}}

Specifically, I am including the following tokens:

refname={{lead.Full Name}}

refcompany={{company.Company Name}}

refemail={{lead.Email Address}}

csmemail={{company.Account Owner Email Address}}

The idea is that the tokens will populate John Doe's information so that upon submission, Will's record will contain the referrer information of John.

I was testing and the only URL parameter that is populating at all is refemail={{lead.Email Address}}. The other URL parameters are not populating with John's info and I have no idea why.

Does anyone know what may be happening?

Thanks,

Hoi

11 REPLIES 11
SanfordWhiteman
Level 10 - Community Moderator

Re: Lead and Company token values not showing up in URL parameter links

You'll need to move the question to Products​ (Move link at the right). This isn't a support space.

Jay_Jiang
Level 10

Re: Lead and Company token values not showing up in URL parameter links

Have you set the url parameters correctly in your form's hidden fields?

pastedImage_0.png

Hoi_Nguyen3
Level 2

Re: Lead and Company token values not showing up in URL parameter links

Yes Jay. As I mentioned, I see that the only URL parameter token that was correctly populating is "refemail". The others were not. Screen Shot 2019-04-10 at 10.00.05 PM.png

Jay_Jiang
Level 10

Re: Lead and Company token values not showing up in URL parameter links

Your problems have something to do with your GTM tags.

These occurs on first load or hard refresh and prefill is empty. Also your hidden field assetname isn't added to your form.

pastedImage_0.png

However, when I do another refresh straight after, those errors aren't there, your pre-fills do work and the assetname hidden field is added. I'm guessing once the page has cached the scripts, then everything works as intended.

Are you using GTM to load marketo scripts?

SanfordWhiteman
Level 10 - Community Moderator

Re: Lead and Company token values not showing up in URL parameter links

Yep, there are indeed a couple of JS <script> tags that Hoi is attempting to add via GTM.

Not only are these tags questionable in their own right (one appears to be a useless honeypot) but their code will never run consistently, as you say, because they depend on MktoForms2 being in scope and that cannot be guaranteed with script-injected scripts.

However, even when the race condition renders those GTM tags dead in the water, that shouldn't affect the hidden field Auto-Fill as that's part of the standard form descriptor + standard library. When I test, the Auto-Fill works just fine even when GTM errors out.

What Hoi is definitely missing is the key ingredient of a referral form: the Munchkin cookie must not be submitted with the referral's email address. That'll associate the referrer's Munchkin session with someone else. And it's not enough to just disable or not initialize Munchkin, the cookie must be forced off the form.

Hoi_Nguyen3
Level 2

Re: Lead and Company token values not showing up in URL parameter links

Thanks, Sanford and Jay.

So frankly, a lot of the javascript and GTM language is slightly over my head. But what I'm understanding is that there are some scripts that are being loaded via GTM but should not be. I can check with my team to see if we have any Marketo scripts loading via GTM. If so, would the action be to remove them from GTM and insert them directly onto the landing page? If that's not possible, what are the consequences of leaving it as is and is there a workaround?

Ultimately, it also sounds like the bigger issue is that the referrer's session will now be falsely associated with the referral's record. Is there a way to remove the cookie session associated with the form submission while still be able to have the autofill capability?

Thanks again,

Hoi

SanfordWhiteman
Level 10 - Community Moderator

Re: Lead and Company token values not showing up in URL parameter links

i can check with my team to see if we have any Marketo scripts loading via GTM.

You do. Whether they're actually useful is another question.

If so, would the action be to remove them from GTM and insert them directly onto the landing page?

Yes.

If that's not possible, what are the consequences of leaving it as is and is there a workaround?

They'll never work reliably (i.e. they will not work) if gtm.js loads before forms2.min.js. You could put gtm.js after forms2.min.js if for some reason these scripts need to be GTM tags.

Is there a way to remove the cookie session associated with the form submission while still be able to have the autofill capability?

Yes, follow http://developers.marketo.com/blog/clearing-marketo-tracking-cookie-from-forms-2-0-submission/.

Hoi_Nguyen3
Level 2

Re: Lead and Company token values not showing up in URL parameter links

Thanks, Sanford. Super helpful.

Just a few follow up questions:

  1. I can't find forms2.min.js in the code anywhere. I'm looking at the landing page template code--is that the right place I should be looking?
  2. Do I have to add/edit any part of the code in the article you sent me re: clearing marketing tracking cookie?

1

2

3

4

5

6

7

8

9

10

11

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

3. I was going to add this code to the landing page template where the one specific form. However, other landing pages use the template and I only want this to affect the specific form in question. Should I create a new landing page template altogether or can I include that above code in the local landing page asset in the Custom Meta Tag section?

Thanks again for all your help!

Hoi

Jay_Jiang
Level 10

Re: Lead and Company token values not showing up in URL parameter links

1. on marketo landing pages, if you're adding a form by click + drag from the widget, the forms js is automatically added.

2. That piece of script needs to be added AFTER your form block, or in the footer of a template.

3. You can target specific forms by adding some logic to match by form id so it's ok to have it in a template for all your other pages.