How does the identify call work when passed an external id?


#1

We're trying to figure out how https://developers.hubspot.com/docs/methods/tracking_code_api/identify_visitor works when passed our own employee_id custom property.

What happens if we pass an email and id and there's no contact? Is it created?

What if there is a contact? Are both the email and id associated with the analytics data?

What if we've identified an email and an id before, but now the email has changed while the id is the same. Will identify lookup a contact by the id and update the email on that? Or will it lookup a contact by the email, see there is none (because it's a new email) and try to create a new contact?

Thanks!


#2

Hi @kth,

The external id that you can use with the Tracking Code API is an entirely external ID used to associate external events with a particular contact, so that you don't always need to know/pass a contact's email address with every new event. It isn't accessible internally at all. To address your specific questions:

  • No contact will be created if you include an id but no email
  • More accurately, the hubspotutk and id are associated with the contact record that has the same email. All existing and subsequent analytics info associated with the hubspotutk is now associated with the contact, and events triggered with the same external id are also associated with the contact.
  • If the email has changed, the id is still associated with the original contact record. If the event you trigger has only the id field, the event is associated with the original contact. If you include both an id and email, the email will take priority.