Lead Capture Tools

tarh33l
Participant

Form submission with cross-domain URL redirect - how to add query string params

SOLVE

We're embedding a HubSpot form on our primary company website.

When a user finishes completing the form, we redirect them to an external URL for another site that we own (this is one of the native HubSpot options when configuring form submissions). The target site is on a completely different domain.

 

Both sites use the same HubSpot tracking code.

 

In the above scenario, we're losing context (Activity tracking) of the contact because of cross-domain cookie issues.

 

So, we'd like to add the appropriate query string params to the target URL such that the tracking code will pick up the contact and continue tracking their activity on the other domain.

 

Is there a way to have HubSpot dynamically add the correct query string parameters before redirecting the user to the external URL? I'm thinking something along these lines when specifying the URL:

 

https://<target domain>/landing_page?__hstc=%HSTC_CODE%

 

I know we can do some of this via JavaScript (as specified here - https://developers.hubspot.com/docs/reference/api/analytics-and-events/tracking-code#get-cross-domai...) but we're really trying to do this without code.

 

Any guidance would be much appreciated.

 

0 Upvotes
1 Accepted solution
tarh33l
Solution
Participant

Form submission with cross-domain URL redirect - how to add query string params

SOLVE

Just a follow-up on this issue.

Turns out that HubSpot does indeed add the necessary tracking params to a target external link. The probem in our case - the form was using an old domain that had a domain forward in place. So, when users were submitting the form, the redirect did have the necessary params but the domain forward was removing them by the time the request actually hit our site. This was all happening so quickly that we didn't notice.

We've updated the external link to be the correct domain (i.e. the one we're forwarding to) and we now see that the tracking parameters are present and a contact's page views show up between both domains.

View solution in original post

0 Upvotes
4 Replies 4
tarh33l
Solution
Participant

Form submission with cross-domain URL redirect - how to add query string params

SOLVE

Just a follow-up on this issue.

Turns out that HubSpot does indeed add the necessary tracking params to a target external link. The probem in our case - the form was using an old domain that had a domain forward in place. So, when users were submitting the form, the redirect did have the necessary params but the domain forward was removing them by the time the request actually hit our site. This was all happening so quickly that we didn't notice.

We've updated the external link to be the correct domain (i.e. the one we're forwarding to) and we now see that the tracking parameters are present and a contact's page views show up between both domains.

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Form submission with cross-domain URL redirect - how to add query string params

SOLVE

Hey, @tarh33l 👋 Thank you very much for taking the time to come back and let us know what worked. — Jaycee







HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.


Learn More.





Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes
franksteiner79
Recognized Expert

Form submission with cross-domain URL redirect - how to add query string params

SOLVE

Hi @tarh33l 

 

Any reasons why you not just using the cross-domain tracking option in HubSpot?

 

Frank

Found my comment helpful? Great! Please mark it as a solution to help other community users.


Frank Steiner

Marketeer | HubSpot Expert | CRM Consultant

InboundPro

Let's Talk About Your Project
0 Upvotes
tarh33l
Participant

Form submission with cross-domain URL redirect - how to add query string params

SOLVE

Hi Frank,

    We are using cross-domain tracking *however* the automatic redirect from the form on domain A doesn't contain the necessary UTM parameters on the URL that points to domain B. So, the net out is that the tracking is effectively lost. If those parameters were automatically added to the URL (which is really the heart of my question), then the cross domain tracking *Would* work.

    If we send marketing emails to contacts with links to domain B, HubSpot will automatically add the necessary parameters in those emails and we will see activity tracking. This is really only a problem in the form redirect scenario.

0 Upvotes