SOLVED

Route form fill to specific thank you page based on the URL

Go to solution
Anh_Ly
Level 2

Route form fill to specific thank you page based on the URL

Is there a way to route a form fill to a specific thank you page based on the URL where the form lives? We are hosting our landing pages on the CMS and would like to prevent the creation of multiple forms.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Route form fill to specific thank you page based on the URL

Sure, you can do this in 2 ways:

1. In an onSuccess listener, dynamically choose the Thank You based on the current URL (for example, appending "_ThankYou" to the current page).

2. In the form setup, by using Add Choice on the Settings page.

View solution in original post

13 REPLIES 13
SanfordWhiteman
Level 10 - Community Moderator

Re: Route form fill to specific thank you page based on the URL

Sure, you can do this in 2 ways:

1. In an onSuccess listener, dynamically choose the Thank You based on the current URL (for example, appending "_ThankYou" to the current page).

2. In the form setup, by using Add Choice on the Settings page.

View solution in original post

Anonymous
Not applicable

Re: Route form fill to specific thank you page based on the URL

Hi Sandford

I can't actually see the referrer URL as an option you can select when setting the choice for the thank you page. It is only offering the fields/questions I have on the form. Can you outline how you would do this? Am I missing something?

SanfordWhiteman
Level 10 - Community Moderator

Re: Route form fill to specific thank you page based on the URL

You'd have to add the field to the form, as here: https://nation.marketo.com/message/79664#comment-79664

Then you can use it in conditions.

shilohpaul
Level 2

Re: Route form fill to specific thank you page based on the URL

Hi @SanfordWhiteman - I know this post is several years old, but I'm trying to implement this for a global form, embedded on WordPress landing pages, that we need to route to different thank you pages. I've added the code from the linked post to the wordpress page. Do I simply submit the form to make the hidden field become available in Marketo? Or do I have to set a field up in Marketo's form settings to listen for the LastFormURL hidden field?

 

<script src="//app-xxxx.marketo.com/js/forms2/js/forms2.min.js "></script>
<form id="mktoForm_1XXXX"></form>
<script>
MktoForms2.loadForm("//app-xxxx.marketo.com ", "***-***-***", XXXX, function(form){
  form.addHiddenFields({ LastFormURL : document.location.href })    
});
</script>

 

Thank you!

SanfordWhiteman
Level 10 - Community Moderator

Re: Route form fill to specific thank you page based on the URL

You need a Marketo (String) field LastFormURL to be created first in Admin » Field Management.

 

You don't need this field to appear in Form Editor at all, it will be added by JavaScript either way.

shilohpaul
Level 2

Re: Route form fill to specific thank you page based on the URL

Thank you! I have that set up. However, it's still not passing the URL through. Our marketo admin does have that hidden field already in the form with a value of null, so I'm wondering if that's overwriting the value passed with the code (which lives on a WordPress page). Would you recommend deleting that field from the form? If so, the field won't be an option for setting the logic in the settings of the form, so I'm not sure how to proceed there.

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Route form fill to specific thank you page based on the URL

OK, so there are 2 levels of "necessary" here, maybe that's confusing.

 

It's not necessary to have the hidden field on the form in Form Editor in order to have it filled in using addHiddenFields() and have the value stored in the Marketo database.

 

It is necessary to have the hidden field on the form in Form Editor in order to use it in the Advanced (Add Choice) Thank You section.

 

Overall I'd like to see the Details of a Filled out Form activity from a lead's Activity Log so we can confirm the value is being posted.

shilohpaul
Level 2

Re: Route form fill to specific thank you page based on the URL

Sure thing! PreviousURI is our name for LastFormURL

 

Webform ID:
1360
Form Fields:
FirstName: First
LastName: Last
Company: Test
Email: first.last@test.com
broadIndustry: Financial Services
gamedium:
gasource:
gacampaign:
previousURI:
marketingCommunicationsOptIn: yes
munchkinId: 801-JLS-289
PreviousURI: http://staginginsxxxx.wpengine.com/uncategorized/form-test/
formVid: 1360
_mktoReferrer: http://staginginsxxxx.wpengine.com/uncategorized/form-test/
checksumFields: FirstName,LastName,Company,Email,broadIndustry,gamedium,gasource,gacampaign,previousURI,marketingCommunicationsOptIn,formid,munchkinId,PreviousURI,_mkt_trk,formVid,_mktoReferrer
checksum: fd904fe78ceb0715de6a3c6a5abc1ffcc0d6d48555444326b7537bc4f9025f8a
Webpage ID:
426668
Query Parameters:
 
Referrer URL:
Client IP Address:
98.164.55.70
User Agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Person ID:
22011334
SanfordWhiteman
Level 10 - Community Moderator

Re: Route form fill to specific thank you page based on the URL

I see both previousURI and PreviousURI in the form post — only one of those can be the right spelling!