Look up a contact or account from cookie

PLemaire5
Member

Hi,

 

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!

 

Pierre

0 Upvotes
2 Accepted solutions
BrandonWoodruff
Solution
Participant

Hi Pierre,

 

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 by marking it as a solution.

BrandonWoodruff_0-1764774083430.jpeg

 

 

Brandon Woodruff
Senior Software Developer @ Pearagon

Still have questions? Reach out at brandon@pearagon.com

BrandonWoodruff_1-1764774083495.png

 

 


 

View solution in original post

0 Upvotes
RubenBurdin
Solution
Top Contributor

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.

 

That’s a one-way bridge into HubSpot’s identity graph, not a query mechanism back out (https://developers.hubspot.com/docs/api-reference/marketing-forms-v3/guide )

 

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 Ruben Burdin
HubSpot Advisor
Founder @ Stacksync
Real-Time Data Sync between any CRM and Database
Stacksync Banner

View solution in original post

0 Upvotes
5 Replies 5
RubenBurdin
Solution
Top Contributor

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.

 

That’s a one-way bridge into HubSpot’s identity graph, not a query mechanism back out (https://developers.hubspot.com/docs/api-reference/marketing-forms-v3/guide )

 

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 Ruben Burdin
HubSpot Advisor
Founder @ Stacksync
Real-Time Data Sync between any CRM and Database
Stacksync Banner
0 Upvotes
PLemaire5
Member

Thanks for your replies both of you!

@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)?

 

Pierre

0 Upvotes
SamTassey
Community Manager
Community Manager

Hi @PLemaire5 

 

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! 

 

Thank you! 

 

Sam, Community Manager 

0 Upvotes
SamTassey
Community Manager
Community Manager

Hi @PLemaire5

 

Welcome to the Community! 

 

@BrandonWoodruff is correct. Additionally, I found this existing post that may also help point you in the right direction here! https://community.hubspot.com/t5/APIs-Integrations/Receiving-cookie-ID-from-the-form-integrated-on-t...

 

I hope this helps! 

Sam, Community Manager 

0 Upvotes
BrandonWoodruff
Solution
Participant

Hi Pierre,

 

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 by marking it as a solution.

BrandonWoodruff_0-1764774083430.jpeg

 

 

Brandon Woodruff
Senior Software Developer @ Pearagon

Still have questions? Reach out at brandon@pearagon.com

BrandonWoodruff_1-1764774083495.png

 

 


 

0 Upvotes