Re: Redirect to Thank You page and append query variables to the URL

mounica_tunugun
Level 2

Redirect to Thank You page and append query variables to the URL

Hi There,

I have 2 assets and i'm using same form for both assets after submit i'm redirecting them to same thank you page. So i'm getting difficulty in analyzing the traffic from which asset most number of forms submitting. So for this i'm thinking to add asset name in the thank you page URL as a query string. So For suppose consider A & B are asset page if I submit form from A URL should be www.websitename.com/thankyou/a like this is it possible OR any other way? 

24 REPLIES 24
SanfordWhiteman
Level 10 - Community Moderator

Re: Redirect to Thank You page and append query variables to the URL

A URL should be www.websitename.com/thankyou/a

To be clear, this URL does not have a query string. You probably mean

   www.example.com/thankyou?a

(please don't use real private domain names in examples, you should use the officially standardized domain example.com)

You can append the asset page to the Thank You URL with this JavaScript;:

MktoForms2.whenReady(function(form) {
form.onSuccess(function(vals, tyURL) {
var tyLoc = document.createElement("a");

tyLoc.href = tyURL;
tyLoc.search += "&fromURL=" + encodeURIComponent(document.location.href);
document.location = tyLoc;

return false;
});
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This will attach the source page's URL to the Thank You URL as the query param fromURL.

mounica_tunugun
Level 2

Re: Redirect to Thank You page and append query variables to the URL

Thanks for the reply.

Do i need to change any parameter values like thank you page URL or any other values
or directly copy paste code will work?

mounica_tunugun
Level 2

Re: Redirect to Thank You page and append query variables to the URL

It's working fine. But i want to display category name (asset name) instead of from url is it possible.

SanfordWhiteman
Level 10 - Community Moderator

Re: Redirect to Thank You page and append query variables to the URL

If you can get the asset name in a JS variable, you're free to use it.

There's no built-in variable that relates to the asset offered by a form. You might have a {{my.token}} or something else that refers to it.

mounica_tunugun
Level 2

Re: Redirect to Thank You page and append query variables to the URL

or else is it possible to display Campaign name in the Thank you page URL

SanfordWhiteman
Level 10 - Community Moderator

Re: Redirect to Thank You page and append query variables to the URL

There's no one-to-one relationship between a Campaign and this LP.

You might be linking from an email to the LP and adding, for example, different UTM parameters in different emails. But doesn't mean there's an established connection between the Marketo Campaign that sent the email and the LP asset. It's all happening on the client (JS) side.

Again, how do you know what asset to present? Whatever method that is, you must have a way of knowing the asset on the form page. So include that in the Thank You URL.

mounica_tunugun
Level 2

Re: Redirect to Thank You page and append query variables to the URL

In  form settings page I have written some choices to download a pdf based on form submit page. How to get that download link to display in my wordpress page. 

SanfordWhiteman
Level 10 - Community Moderator

Re: Redirect to Thank You page and append query variables to the URL

Are you asking how to dynamically create an <a> tag that links to the Thank You URL, instead of redirecting the person immediately to the Thank You URL? Please try to be more specific in your, er, specifications.

mounica_tunugun
Level 2

Re: Redirect to Thank You page and append query variables to the URL

Is this visible to every one or only to marketo people. If it is visible to only marketo people I can explain you clearly.