Associate contact with hutk cookie though API

contacts

#1

I have things set up so new users on my site become hubspot contacts. A requirement came across that I need to include a HUTK cookie value with them. I’m using the Contacts API to send over basic things like name, email, number of times they logged in, etc. I want to associate the contact with the cookie value that tracks them around. I can figure out a way to grab the cookie from the user’s browser and send it to the Contact record but I don’t know how that will associate to the data on which endpoints the user saw and all that. It looks like the only way to do that is by creating the Contact via a HubSpot Form submission. I can’t do that. My app is already quite mature (angular / rails) and I don’t think that replacing our signup with a hubspot form is reasonable.

Has anyone had luck with this?


#2

@trivett It doesn’t have to be a HubSpot form. You can have your own form or when you login just make a post call to our servers with the necessary information. If you have the information then you don’t need to actually have a form at all.
Steps to do this would be to make a form in HubSpot then on your app just make a post call to “fill” it out. You won’t have to make any changes to your front end just add the additional call when you hit the contacts API to also hit the Forms API.


#3

@trivett I just became aware of something we added to our API this morning. You can now use this identify endpoint to accomplish this as well. This will be a cleaner approach to your question. The only thing to note is that this will not fire an additional call so you need to execute this before the tracking code fires so the identity is logged as well.


#4

That’s brilliant, pmanca. I will make this enhancement soon and PR to the
wrapper that I am using :slight_smile:


#5

@pmanca I create a Contact server side using this node library

After a Contact is created, how do I get the user's hutk so I can track their activity?