Rest API based form submission and Cookie



We are changing our architecture and hence this ticket. What we are doing is, we have our own REST API based backend. I need to understand how hubspot works with our APIs.

Let me explain by example.

  1. User comes to our website the first time. Hubspot creates a cookie
  2. The user navigates few pages. Hubspot track this based on Cookie
  3. Now when customer signup from our frontend, we call our internal REST API to create a user in our database and also want to create a Contact in Hubspot.

Question is, How HubSpot can map the before signup browsing history with the newly signup user? As cookie is on frontend and HubSpot form submission is happening using REST API, how mapping will work?

What is the best way to handle this?


Hi @Jimit_Bagadiya,

Usually, the association happens from a form submission. HubSpot forms pull the hubspotutk cookie from the visitor's browser and includes it in the form submission, which associates the tracking info to the new contact record in HubSpot. This can also happen if a visitor clicks through a marketing email to a site with the HubSpot tracking code, or via a custom identify call.

Depending on your exact setup, you'll likely want to use either the Forms API or the Tracking Code API to do this association manually. Can you submit to the HubSpot Forms API when a visitor signs up? Or, can you include an identify call on the frontend when a user submits their email address? I've included docs for both APIs below: