Submission of Form with same hutk ID creates two separate Contacts, deduplication fails
SOLVE
Hi there,
We have Cookie Tracking enabled in our system. We have several subdomains, all under the same domain. We have two main Forms that we submit data into (well, we have more, but these are the ones that most matter), and both have Cookie Tracking enabled. We also allowed the submission of Forms without email addresses.
I verified that the `hutk` value is the same for both. However, the data is not merged into the same Contact, rather, a new Contact is created.
Here's an example. There are two hubspotutk tracking cookies set:
Both form submissions succeeded (HTTP 204). You will note both have proper hs_context.hutk value. However, two different contacts were created.
Interestingly, it seems like further Forms (different from the first two) submitted on app.whatever.com do deduplicate properly, but by that point there's always an email included.
This seems like a bug with deduplication using hutk, but I'm hoping it's just me doing something wrong.
Does anyone have any idea what is actually happening?
I've shared the details of my investigation with Cooper, but here are the main points:
A valid email always takes precedence over a matching hutk value in determining which contact record will be updated.
The "first contact" was only identifiable with a hutk value.
The "second contact," with the email valuesomefakeemail@intomato4.com, was created by your custom app via the Contacts API just before the second form submission was ingested.
Since the Contacts API created the second contact with the email valuesomefakeemail@intomato4.com, the second form submission was associated with that record, making it appear that the two form submissions created separate records.
Submission of Form with same hutk ID creates two separate Contacts, deduplication fails
SOLVE
Just wanted to update I finally got this working.
Our issue is that we want the details of the Leads before knowing their email. So we submit a form with no email.
Then, we eventually find out their email after they register - but by that point we'd like to have a Contact created and accessible for work in the backend. So we can't wait for submitting another form in the frontend.
Unfortunately, the Contacts API does not support sending the hubspotutk identifying token when creating or updating a contact. So, we've had to use the forms API, which we have successfully. Then we call createOrUpdateContact() using the email as an identifier, to set other fields and manage the Contact as required.
However, it seems that because of timing issues, this then CREATES another Contact.. so deduplication fails again.
When we add a 3 second sleep between the Form submission and the Contact createOrUpdate() call, everything works just as expected.
This can be solved by allowing us to send hutk when creating or updating Contacts using the Contacts API.. or by us finding a way to work around making this call at all, until later on.
I've shared the details of my investigation with Cooper, but here are the main points:
A valid email always takes precedence over a matching hutk value in determining which contact record will be updated.
The "first contact" was only identifiable with a hutk value.
The "second contact," with the email valuesomefakeemail@intomato4.com, was created by your custom app via the Contacts API just before the second form submission was ingested.
Since the Contacts API created the second contact with the email valuesomefakeemail@intomato4.com, the second form submission was associated with that record, making it appear that the two form submissions created separate records.
Submission of Form with same hutk ID creates two separate Contacts, deduplication fails
SOLVE
Hi Isaac,
Thank you! And kudos. I indeed discovered this issue about an hour ago. A team member created a Hubspot contact in the backend without me knowing. This indeed has causes the problem I encountered. I wanted to thoroughly verify it before posting here, but you've beaten me to it.
I will remark that I encountered two new issues when attempting to fix this:
1. First, while debugging, I noticed that the `hubspotutk` cookie does not always become accessible in all sub-domains, so that was my first direction to investigate. I created a thread about this:
This was not the culprit, as even by forcing the hubspotutk to be set on the top level domain - this issue was not resolved.
2. Second, I thought that indeed it could have been a timing issue. This was when I asked our backend developer and found about the Contact creation. So what I attempted to do then was pass in the context.hutk (or hs_context.hutk, or just hutk or hubspotutk) value when creating the Contact, assuming they would then get linked. However, this apparently is not possible with the current API. I created a thread about it:
Submission of Form with same hutk ID creates two separate Contacts, deduplication fails
SOLVE
Just wanted to update I finally got this working.
Our issue is that we want the details of the Leads before knowing their email. So we submit a form with no email.
Then, we eventually find out their email after they register - but by that point we'd like to have a Contact created and accessible for work in the backend. So we can't wait for submitting another form in the frontend.
Unfortunately, the Contacts API does not support sending the hubspotutk identifying token when creating or updating a contact. So, we've had to use the forms API, which we have successfully. Then we call createOrUpdateContact() using the email as an identifier, to set other fields and manage the Contact as required.
However, it seems that because of timing issues, this then CREATES another Contact.. so deduplication fails again.
When we add a 3 second sleep between the Form submission and the Contact createOrUpdate() call, everything works just as expected.
This can be solved by allowing us to send hutk when creating or updating Contacts using the Contacts API.. or by us finding a way to work around making this call at all, until later on.
Submission of Form with same hutk ID creates two separate Contacts, deduplication fails
SOLVE
Apologies for my delayed response, @advance512, but thank you for the insight.
I don't know of any plans to add hutk support to the Contacts API, but I will keep your use case in mind. If others find Alon's post helpful, please upvote and comment below.