How to extract the vid of contact from the website cookie

Highlighted
New Contributor

 

How to get the VID of the HubSpot contact from the cookie, to send to our backend? 

 

Scenario:

1. Hubspot tracking integrated on to our website.
2. A new visitor visited our website and filled-up the form with email-id and submitted it.

3. Next time when he visits,  how to get VID of the visitor and send it to our backend so that it can sync with the Hubspot via API at the backend?

 

 

Reply
0 Upvotes
3 Replies 3
Highlighted
HubSpot Moderator

Hey @Ashwin007,

 

If at step 2, the visitor submitted a form and it's being created as a contact in HubSpot with the HubSpot cookie, you can use this endpoint - Get a contact by its user token to get contact using the hubspotutk cookie. The return response of the endpoint will show the vid.

 

Hope this helps!  

Reply
0 Upvotes
Highlighted
New Contributor

Yes, at step-2 the submitted form will create a contact in Hubspot.

 

But is there any way to check whether this visitor is a contact or not. I mean among the visitors say only 1% fillup the form. Does this mean we have to call the contact-by-user-token-api for every visitor irrespective of whether he is a contact or not? Or is there any hint that this visitor is contact so that we can invoke that API to only those visitors, to get the vid. 

 

 

Reply
0 Upvotes
Highlighted
HubSpot Moderator

Hey @Ashwin007,

 

It would be the former. You would have to call the Get contact by utk endpoint if you'd like to check if the visitor is a contact/visitor. There isn't currently a way to check if a visitor is a contact without calling the API.

Reply
0 Upvotes