Update email in tracking_code_api/identify_visitor


When a user compiles a form I send _hsq.push(["identify",{ email: XXX }]); and then via API I create a Contact.

What happens if a user first send a form with name@email.com and later send another form (without deleting cookies) with secondname@email.com? Both times I issue the _hsq.push, two Contacts are created in HubSpot (as emails are different) but it looks like the first one get pageviews in his activities. It looks like the second _hsq.push does ot update the value. Could you please confirm this?


Welcome, @pmonte!

Yes, that is expected behavior. The identify function relies on the email value to identify contacts, so passing an unknown email will create a new contact.

Is there a reason you're using the identify method on your forms instead of the Forms API? This API is better-suited to forms and allows you to update a contact's email address by passing the hutk cookie token value.