Creating Popup if no HubSpot data exists; specifically no email / Identifying user


#1

Hello, I am new to the HubSpot API and would love any help that can be given me. I’m trying to create a popup on the condition that the visitor doesn’t have an email given to us through a HubSpot form. I know HubSpot stores data in cookies, is there a specific cookie that I can look at for this data? Or will I need to make use of the API?


#2

Hi @equartey,

We identify visitors by their usertoken, which is a value present in the hubspotutk cookie. You can use the following endpoint to pull contact records by usertoken. if the record returned has is-contact equal to true, then there exists a contact record (with email) in HubSpot. It’s not recommended to make a call to this API with each page load, as you could very easily use up all of your API calls that way. Additionally, the endpoint does not allow for CORS, so if you are looking up contacts from their user token on the client, you’ll need to spin up a proxy server to interact with the API.