APIs & Integrations

SN1
Member

Forms updating one contact

Hi,

 

We have a form that we've set up in HubSpot that we are posting data to via the Forms API on the following URL: https://api.hsforms.com/submissions/v3/integration/submit/:portalId/:formId.

 

The data is being entered into HubSpot ok, however if we do multiple form submissions from one browser, we've noticed that the intial contact simply gets ovewritten with the new data.  We tried turning on the "Always create contact for new email address" in the form options, and we now get a new submission for the form, however it's a still updates the original so we end up with mulitple submissions from the same contact and that contact just ends up with multiple email addresses.

 

Does anyone have any suggestions? I'm concerned that if this is used at a trade event or similar that we'll just end up with one persons contact details at the end.

 

Thanks

0 Upvotes
5 Replies 5
SN1
Member

Forms updating one contact

Hi,

 

Ok I've done a few more tests and it would seem to be centered around the JavaScript analytics code for HubSpot that we have on the site for tracking purposes.  When we removed this code, everything worked as you would expect and we had a new contact created for every submission without having the old contacts updated.  We did of course not have a cookie value to pass along with the API request, so we re-enabled the script to have a valid cookie value and then disabled it again.  This meant we were able to submit multiple entries with a cookie value and again, everything worked as expected with one contact per submission and no updating of old records.  We were however being told in the contact details on HubSpot that the cookie that was needed to link form submissions was not being sent, despite us including a cookie value.  When we re-enabled the script, we went back to the problem of old records being updated despite a new record being created when submitting multiple times from one browser.

 

So it would seem that something is happening with these scripts which is connecting every submission and updating previous ones.  Given that we have a valid cookie created in our browser and that we sending that value in our API call, but we still get the message that the cookie needed to link form submissions does not exist, this suggests to me that something happens in HubSpot with that script which is using the cookie value and that there's some kind of bug that will create a new contact per submission, but will also update the existing ones that share that cookie value.

 

I've managed to create a workaround by deleting all HubSpot cookies after a form submit (__hssc, __hssrc, __hstc, hubspotutk) and this forces a new cookie value which seems to have stopped the overwriting of previous entries.  Can you see any problems with doing that for analytics, etc?  I can't think of another way to get round this bug!

 

Thanks

0 Upvotes
SN1
Member

Forms updating one contact

Hi Dennis,

 

Thanks for replying.  Clearing the cache doesn't seem to affect it, however deleting the cookies does.  I think this is because it clears the HubSpot tracking cookie.  We are passing the cookie value through via the API in the context object hutk field, however whether we include this or not does not stop the record being overwritten if the cookie exists.  I can understand that it might think that the presence of the cookie means it should overwrite the data, however I thought the "Always create contact for new email address" option was designed to stop this?

 

If you have any suggestions please do let me know!

 

Many Thanks.

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Forms updating one contact

I wonder if the content of the cookie is not updated before you are sending the data 🤔

@webdew , do you have any ideas here?

0 Upvotes
SN1
Member

Forms updating one contact

Is there something I have to do with the cookie before submitting the form?  At the moment I'm just grabbing the value and passing it along with the API call.

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Forms updating one contact

@SN1 ,

Curious to know what happens if you clear cache on browser..

@tjoyce , do you have any thoughts?

0 Upvotes