How to pass UTM parameters from the form hosted on Marketo LP to the destination page | Community
Skip to main content
Diana_Jakubaity
New Participant
September 20, 2018
Solved

How to pass UTM parameters from the form hosted on Marketo LP to the destination page

  • September 20, 2018
  • 1 reply
  • 6161 views

Hey,

Trying to figure out the rule we could add to pass ORIGINAL UTM parameters value from the form hosted on the Marketo LP to the destination page. We need this for our tracking in SFDC.

For example, this is how we use urls in our company: person is coming from facebook and lasnds on this page that hosts Marketo form: www.form-hosting-landing-page.com/?utm_medium=social-paid&utm_source=facebook&utm_campaign=my-campaign

Once someone fills out the form, we would like to pass all utm parameters and destination page to be:

www.destination-page.com/?utm_medium=social-paid&utm_source=facebook&utm_campaign=my-campaign

For any other CTAs on our marketo LP we use this code to pass UTM values: <a class="block pass-query" href="destination-page.com" target="_blank"><button class="btn btn-orange">Register</button></a>

Can you please advise if the similar function is available for forms as well?

Best answer by SanfordWhiteman

For any other CTAs on our marketo LP we use this code to pass UTM values: <a class="block pass-query" href="destination-page.com" target="_blank"><button class="btn btn-orange">Register</button></a>

This isn't any kind of built-in browser or Marketo function. You must have separate code on your page that finds <a> tags with this class and rewrites the href.

If you want to add the current page's query string to the Thank You URL of a Marketo form, do it like so:

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,thankYouURL){

    var thankYouLoc = document.createElement("a");

    thankYouLoc.href = thankYouURL;

    thankYouLoc.search += ( thankYouLoc.search.length ? "&" : "" ) + document.location.search.substring(1);

    document.location = thankYouLoc;

    return false;

  });

});

But I really don't think this is the best way to transport the original UTM information (having just worked with a client late last night whose analytics team was confused by this approach). Far better is persisting the original UTM parameters in a cookie, or at the very least relabeling the parameters as original_utm_whatever so you don't create extra GA sessions.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
September 20, 2018

For any other CTAs on our marketo LP we use this code to pass UTM values: <a class="block pass-query" href="destination-page.com" target="_blank"><button class="btn btn-orange">Register</button></a>

This isn't any kind of built-in browser or Marketo function. You must have separate code on your page that finds <a> tags with this class and rewrites the href.

If you want to add the current page's query string to the Thank You URL of a Marketo form, do it like so:

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,thankYouURL){

    var thankYouLoc = document.createElement("a");

    thankYouLoc.href = thankYouURL;

    thankYouLoc.search += ( thankYouLoc.search.length ? "&" : "" ) + document.location.search.substring(1);

    document.location = thankYouLoc;

    return false;

  });

});

But I really don't think this is the best way to transport the original UTM information (having just worked with a client late last night whose analytics team was confused by this approach). Far better is persisting the original UTM parameters in a cookie, or at the very least relabeling the parameters as original_utm_whatever so you don't create extra GA sessions.

Diana_Jakubaity
New Participant
October 2, 2018

Hey Sanford,

We track everything with SFDC using Bizible that requires to have UTM parameters for accurate reporting, therefore only cookies tracking will not work for us.

SanfordWhiteman
New Participant
October 3, 2018

I didn't say "only" cookies, I said that without cookies you cannot do accurate journey tracking. And this is why Bizible itself uses cookie-keyed persistence.