APIs & Integrations

rsobers1
Member

Working with the HubSpot contact object client-side

With Drip’s tracking code, any time identify is called it returns details about the contact (if one exists) which you can then use on the page or with other scripts.

I’d love to do the same with HubSpot. Is there a way to get access to contact properties from client-side JavaScript by calling functions available in the HubSpot tracking code?

0 Upvotes
1 Reply 1
Dadams
HubSpot Employee
HubSpot Employee

Working with the HubSpot contact object client-side

Hi @rsobers

The HubSpot tracking code only deals with writing data to HubSpot, it can’t be used to get data for visitors or contacts.

It is possible to get contact data from the hubspotutk cookie (created by the tracking code), but the request to the API needs to happen server side, so you’ll need to make the JavaScript request to your server, then have your server make the request (after adding the authentication to the request) to HubSpot.

Get a contact by its user token

GET /contacts/v1/contact/utk/:contact_utk/profile - For a given portal, return information about a single contact by its User Token (hubspotutk)

0 Upvotes