May 10, 201911:49 AM - edited May 10, 201911:52 AM
Participant
How To Inherit UTM Tags From Form Submission to Thank You Page
Hi, I need help to persist UTM parameters to the next page when we click a CTA on the home page or submit a form on any landing page.
For example, if someone fills out a form at we.curate.co/florists?utm_campaign=mayesh&utm_channel=eblast&utm_medium=paid they go to the thank you page (https://we.curate.co/event-professional-thank-you) without the UTM.
Because we pull last touch attribution from the utm and would like to automate some of it based on the last page seen property, we need the thank you page to have the same UTM tag that was on the first page they came to on that particular session.
If you're using the default UTM parameters suggested by Google, they should be applied to the entire Session automatically without any extra work necessary. Thats inside Google Analytics, but perhaps you are using those UTMs in another system for reporting purposes?
In order to get them to persist in the thank you page redirect, you're likely going to need to manually embed the form so you can utilize the Forms JS API. Specifically the onFormSubmit callback. Inside that you should be able to attach the existing query string to the redirect URL, see below for an example:
As I mentioned previously, you can't do this with the native HubSpot form module (it doesn't allow you to modify the embed code or add JS into the callback methods.
But this should at least get you started. Hopefully it helps!
How To Inherit UTM Tags From Form Submission to Thank You Page
@hollydechelle also - forgot to touch on your CTA issue.
The CTA issue is one that is much harder to solve. Unfortunately HubSpot doesn't offer an API to extend/work with the embedded CTAs. This is a problem because HubSpot masks the redirect location via an encoded/encrypted query parameter as shown below:
It doesn't seem like its using a basic encoding method such as Base64 - which makes this nearly impossible to decode and replace with a new encoded value dynamically.
Until HubSpot either provides documentation on what kind of encoding/encryption they use for those URLs (unlikely) - OR - HubSpot provides a JavaScript API to modify how CTAs function outside of manually configuring them in the product dashboard - you're kind of stuck between a rock and a hard place.
Your best bet would be to refrain from using HubSpot CTAs in favor of standard links that you can target with JavaScript to update the href value to append the query string as you want to do.