APIs & Integrations

amitkumarsingh
Member

Use many Thank you Page on one form submission

Hi , Hope you’re well. We are looking for some help with a Hubspot form that will be embedded in a CMS page. Here is a step by step breakdown of how the journey will work from a visitor’s perspective:

• Visitor lands on page

• Visitor completes the form

• Visitor is redirected to a ‘Thank You’ page

• Link to asset is sent to the visitor via email From a Hubspot perspective we have a challenge. We are trying to minimise the number of forms that we need to create. The issue that we have currently is that the URL for the Thank You will be different for each site (due to the country folder part of the URL). Ideally we would like to create a form for each asset per language (we would need to create 4 versions) rather than by site (10 versions for each site). We have found a way to do this – by adding in a script into the embed code that looks at the URL of the page that the form is completed on and then redirects the visitor to the relevant ‘Thank You’ page. For example,

• US Visitor o Visitor completes form on https://www.basware.com/en-us/resources/2019-gartner-magic-quadrant-for-procure-to-pay-sui o Is redirected to https://www.basware.com/en-us/thank-you o Asset link is emailed

• UK Visitor o Visitor completes form on https://www.basware.com/en-gb/resources/2019-gartner-magic-quadrant-for-procure-to-pay-sui (asset uses same form as above in HS) o Is redirected to https://www.basware.com/en-gb/thank-you (redirected to UK ‘Thank You’ since EN-GB is in the complete page URL) o Asset link is emailed

• FR Visitor o Visitor completes form on https://www.basware.com/fr-fr/ressources/2019-gartner-magic-quadrant-suite-p2p (same asset as above but different form due to FR form language) o Is redirected to https://www.basware.com/fr-fr/merci (simple redirection since only FR-FR uses FR language) o Asset link is emailed What we need you to do is to supply the additional script that can be added to the embed code to ensure that the visitor is redirected to the relevant Thank You page. Please let us know if you have any other questions. Kind regards

0 Upvotes
1 Reply 1
WendyGoh
HubSpot Employee
HubSpot Employee

Use many Thank you Page on one form submission

Hi @amitkumarsingh,

 

Thanks for detailing down clearly your team use case.

 

When looking to set up a redirect url on the HubSpot embed form, you can do so by inserting the following code:

 

<script>
	hbspt.forms.create({
		portalId: "{{portalId}}",
		formId: "{{formId}}",
		css: "",
		onFormSubmit: function($form) {				 
                       window.location = 'https://www.basware.com/en-us/thank-you/';
		} 
	});
</script>

This code would be implemented on the US visitor form page

 

The code would be implemented the same across the other language page and the specific line to modified for each page is the window.location url. 

 

Hope this helps to further clarify things!

 

0 Upvotes