APIs & Integrations

MattyT
Participant

How do I connect cookie tracking when my custom form creates the new HUB contact through API?

Hello,

I am running into an issue with new trial account signups on my website tracking previous cookie history. When a user comes to my site and completes this custom form we activate > redirect them into our application. When the user signs up we create a new contact record in Hubspot, but we are not pulling over or correctly capturing the cookie information from the user.

All of my new leads / signups original source is showing as ‘direct traffic or offline’

Has anyone else run into this issue? Any help would be appreciated. Thanks,

Matt

0 Upvotes
2 Replies 2
Bob2245
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

How do I connect cookie tracking when my custom form creates the new HUB contact through API?

Hi there,

 

Sorry for resurrecting this thread, but I have this exact scenario and a follow-up question to the solution posted above. 

 

The scenario is what I'd call a generic SaaS scenario. Client has a sign-up form of their own design (not a Hubspot form) that creates a new account in their SaaS application. Following this, they've built an API connection between their application and Hubspot, that creates a new Company and Contact record with the provided information. They want to similarly get session data and conversion info to populate Original Source, but also to feed Hubspot Ads reporting (i.e. how many contacts were created from a particular ad that leads to the custom sign-up form). 

 

I'd say the hubspotutk cookie is also the answer, but does it also apply when creating a new contact, rather than submitting a HS form, or can I only pass it through a Form submit?

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

How do I connect cookie tracking when my custom form creates the new HUB contact through API?

Hi @mthompson,

You need to collect the hubspotutk cookie from the visitor’s browser and pass that in the hs_context parameter with the form submission: