I want to find a contact in the CRM based on the cookie dropped by hubspot to identify website visitors. It looks like it's impossible with the API. Anyone has a solution?
Thanks for reaching out to the Community! 😊 From what you described, it sounds like you’d like to use the HubSpot tracking cookie to look up a specific contact via the API. Is that right?
Here are some workarounds you could try: - Store your own id on the contact. Save the id on a custom property on the Contact, and then use HubSpot's CRM Search API to find the contact based on the ID property you create. - Any time you know whoe the visitor is, log the tracking cookie and contact id in your own database, and then you can do lookups based on the cookie through an integration on your own DB and the HubSpot API.
Let me know if this helps, or if you have any other questions!
✔️Was I able to help answer your question? Help the community bymarking it as a solution.
Hi @PLemaire5 , you’re running into a real platform constraint, not missing an endpoint. HubSpot’s tracking cookie (hubspotutk / hutk) is meant to help HubSpot associate activity when a visitor becomes known, but HubSpot does not expose an API that lets you reverse-resolve “cookie > contact” for a third-party integration.
That’s largely for privacy and security reasons, and it’s why you won’t find a supported “lookup by hutk” call.
What you can do (and what most integrations end up doing) is treat the cookie as an input only at the moment of identification. For example, when you submit a HubSpot form via the API and pass the hutk, HubSpot will attach that browser’s activity to the contact it identifies in that submission.
On the “minimal client involvement” point: if the blocker is “clients would have to create properties,” note that a public app can create the needed custom property programmatically during onboarding using the CRM Properties API. So the client doesn’t manually add anything, but you still end up with a stable key you can search on later (https://developers.hubspot.com/docs/api-reference/crm-properties-v3/guide )
Practically, you store your own external visitor/user ID (or your own cookie) in HubSpot, and keep the hutk > external ID mapping on your side. So: no direct cookie lookup, but you can (a) identify/associate at submission time, and (b) make the “searchable identifier” painless by creating it automatically as part of app install.
Did my answer help? Please mark it as a solution to help others find it too.
Ruben Burdin HubSpot Advisor Founder @ Stacksync Real-Time Data Sync between any CRM and Database
Hi @PLemaire5 , you’re running into a real platform constraint, not missing an endpoint. HubSpot’s tracking cookie (hubspotutk / hutk) is meant to help HubSpot associate activity when a visitor becomes known, but HubSpot does not expose an API that lets you reverse-resolve “cookie > contact” for a third-party integration.
That’s largely for privacy and security reasons, and it’s why you won’t find a supported “lookup by hutk” call.
What you can do (and what most integrations end up doing) is treat the cookie as an input only at the moment of identification. For example, when you submit a HubSpot form via the API and pass the hutk, HubSpot will attach that browser’s activity to the contact it identifies in that submission.
On the “minimal client involvement” point: if the blocker is “clients would have to create properties,” note that a public app can create the needed custom property programmatically during onboarding using the CRM Properties API. So the client doesn’t manually add anything, but you still end up with a stable key you can search on later (https://developers.hubspot.com/docs/api-reference/crm-properties-v3/guide )
Practically, you store your own external visitor/user ID (or your own cookie) in HubSpot, and keep the hutk > external ID mapping on your side. So: no direct cookie lookup, but you can (a) identify/associate at submission time, and (b) make the “searchable identifier” painless by creating it automatically as part of app install.
Did my answer help? Please mark it as a solution to help others find it too.
Ruben Burdin HubSpot Advisor Founder @ Stacksync Real-Time Data Sync between any CRM and Database
@BrandonWoodruff this is exactly the outcome I want and the solution I envisionned, but this would requires our clients to do the work to add the new properties etc. which I'd rather avoid.
Any idea to do what I want with minimal involvement for my clients (who own and manage the CRM)?
Thanks for your response! If you're looking to store data in HubSpot and there isn't an existing property at the object level, then I'm afraid the only way to do so would be to create a custom property to host the data.
From a development perspective I'll leave that open to see if @BrandonWoodruff has any insight there!
Thanks for reaching out to the Community! 😊 From what you described, it sounds like you’d like to use the HubSpot tracking cookie to look up a specific contact via the API. Is that right?
Here are some workarounds you could try: - Store your own id on the contact. Save the id on a custom property on the Contact, and then use HubSpot's CRM Search API to find the contact based on the ID property you create. - Any time you know whoe the visitor is, log the tracking cookie and contact id in your own database, and then you can do lookups based on the cookie through an integration on your own DB and the HubSpot API.
Let me know if this helps, or if you have any other questions!
✔️Was I able to help answer your question? Help the community bymarking it as a solution.