SOLVED

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

Go to solution
Highlighted

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

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="https://www.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?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

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

For any other CTAs on our marketo LP we use this code to pass UTM values: <a class="block pass-query" href="https://www.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.

View solution in original post

6 REPLIES 6
Highlighted
Level 10 - Community Moderator

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

For any other CTAs on our marketo LP we use this code to pass UTM values: <a class="block pass-query" href="https://www.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.

View solution in original post

Highlighted

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

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.

Highlighted
Level 10 - Community Moderator

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

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.

Highlighted
Level 10 - Community Moderator

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

Also, if you could mark my response with the code as Correct as I assume you've tested it out...

Highlighted
Level 1

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

I have wrote code for the same in order to get values via JS from url and push them on another page.

If there's still issue please let me know i can help in passing data.

Thanks

Raghav Chugh
Highlighted
Level 10 - Community Moderator

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

Well, there's code in my earlier response to forward the LP query string to the Thank You URL... if you have an alternate approach, feel free to post it, but it can't be any simpler than the above.