Updating offline contact with cookie


#1

After creating a Contact using the Contacts API, is it possible to update that Contact with the hubspotutk cookie once that information has been made available? I attempted to post to a Form using the same Contact email but the cookie information was not applied to that Contact, despite the Contact page stating that a form was submitted.

Thanks!


#2

Hi @Derek_Veenstra,

Offline contacts can have cookie associated later via form submission. It's possible that the hs_context field from your form submission was malformed or missing. Can you give me some more info on the form submission data you sent?


#3

Hi @Derek_Gervais,

I am using the same form submission API call for updating offline contacts as creating new ones, creating a new contact shows the cookie history but posting the form for an offline contact does not. The hs_context field is populated and not malformed (since it works when creating a new contact).

hs_context: '{"hutk":"583e7472f6cd65e0a49969a7c23ea316","ipAddress":"::ffff:172.18.0.9","pageUrl":"https://signup-page-url-redacted-here","pageName":"Signup"}'

Is there any way to view the cookie info of a contact in the Hubspot UI? Can I provide any further form submission info for you to help debug?

Thanks!!


#4

Hi @Derek_Veenstra,

It's not possible to view cookie information directly in the UI, but I should be able to dig into a specific example contact. Can you send me a link to an example contact in HubSpot? That hs_context parameter appears to be formatted correctly, so in order to dig deeper I'll need to examine an actual contact.


#5

An example of a Contact I created via Contacts API and then posted to a form with cookie info is: https://app.hubspot.com/contacts/3833483/contact/144301/?interaction=note

An example of a Contact created via posting to a form that successfully got the cookie info is: https://app.hubspot.com/contacts/3833483/contact/140651/?interaction=note

(I assume that the cookie is what merges the Contacts and appends the email to a list? Maybe that is part of the problem I'm experiencing, it won't merge offline Contacts?)

Thanks @Derek_Gervais !!


#6

Hi @Derek_Veenstra,

So it looks like you're including the hutk parameter correctly, but in the case of the first example contact you linked to, the usertoken was already associated with a different contact record. Normally, form submissions will deduplicate based on usertoken (i.e. the form submission would have been associated with the contact record with the same usertoken). However the fact that there was already a contact record with the same email address took priority, and the usertoken was ignored. This often happens when testing, but it's much more rare among actual visitors. Additionally, it's intentionally designed to prevent analytics data from one usertoken from updating multiple contact records.

Going forward, you shouldn't have an issue if the usertoken you pass with a form submission isn't already associated with an existing contact. To check which contact a usertoken is associated with, you can use the 'Get contact by usertoken' endpoint (see below).