Contact Created via API associating with session/cookie

Hi all!

I’m currently using the Hubspot Dev API to create my contacts (the form is not completed simple submit button as I make a backend call first) as I associate it with custom objects that are modified in the onboarding flow.

Because I’m using the API to create my contacts rather than auto creating it via form and using the tracking code API, I’m unable to capture cookie session information (both pre-auth and after authentication) for my contact. This means I don’t see the true source of the contact nor page views.

Is there a way to associate the identity of the browser session/cookie to a contact I’ve created so that I can capture more activity details?

Thanks!

Hi @cageyshoe

I wonder if the all knowing @tjoyce has some thoughts for you.

Hello @cageyshoe -

You would pass the context parameter when submitting the form through the form submission API

"context": {
 "hutk": ":hutk", // include this parameter and set it to the hubspotutk cookie value to enable cookie tracking on your submission
 "pageUri": "www.example.com/page",
 "pageName": "Example page"
 },

https://legacydocs.hubspot.com/docs/methods/forms/submit_form?_ga=2.218978969.1636743409.1617635584-346463039.1603807645

Thanks for the reply! Currently, I’m not submitting the contact via the form submission API. I’m only creating the contact, not after a form submission but after our own internal backend processing (after taking inputs from a form). Would this be a form API call after the contact is created? As in - can this Form API request take in the email and name (after contact is created) and just update it with the hutfk parameter? I’m also assuming this is only possible in the v1 of the APIs (I’m currently using v3). I would like to store the hubspot contact id internally too which is why the “createContact API” is nice as the response to that is the generated ID.

Thanks again!

Following up on this question as clearly nobody has replied to cageyshoe about how to create a contact using the developer API and add the hubspot session information. I cannot use the form submission API as the contact needs to be created at a later stage.

I would like to create a contact via the Developer API and specify both the hubspot session ID and the Google Click Id. I know I can use the hs_google_click_id field but what do I use for hubspot session?

Did you ever work work this out?