How to manually stamp utm using the javascript api?

Highlighted
New Contributor

hi,

 

We are using SSO during registration and it strips away the UTM information on redirect. To work around this we are storing the utm information in cookies and serving it through the library for other tracking tools.

 

What's the recommended way to manually stamp the UTM information for a user?

 

Thank you!

 

Reply
0 Upvotes
2 Replies 2
Highlighted
HubSpot Moderator

Hey @raylenmargono 

 

Assuming you're looking to pass these UTM params when the registration is creating contacts in HubSpot, your best bet is to use our Forms API so that you can pass the pageUri /w UTM parameters and also pass the hutk with our context parameter. 

 

This parameter allows you to pass specific data such as:

"hutk": ":hutk", // include this parameter and set it to the hubspotutk cookie value to enable cookie tracking on your submission
    "pageUri": "www.example.com/page",
    "pageName": "Example page"

The hutk is the cookie aspect to do with our tracking code which, when creating a contact will update the source to match the conversion source.

 

I hope this helps!

Matthew Willson

HubSpot Developer Support
Reply
0 Upvotes
Highlighted
New Contributor

Hi @Willson ,

 

Thank you for your quick response - i appreciate it. Sorry for the confusion was wondering if there was a way to do this with the tracking api on the browser.

 

https://legacydocs.hubspot.com/docs/methods/tracking_code_api/tracking_code_overview

Reply
0 Upvotes