APIs & Integrations

chrsmith
Member

Associating analytics with Contact without form submission

It seems that in order to associate analytics data with an existing contact, I must provide an email value when calling identify. However, from the documentation it seems like that shouldn't need to be the case.

I assume this is just an error on my part, but want to double check my understanding of all the moving parts:

Identify a visitor

_hsq.push(["identify", { {identity details} }]);

I first identify users by calling identify in the backend of my application (no access to any of the browser cookies). This creates the contact with the id and email fields set. The contact then is listed with "Original Source" as "Offline Sources".

My problem comes when I later want to associate the user's browser activity / analytics with that existing contact. This allows me to get better insight, and more importantly, do conversion tracking. e.g. seeing the effectiveness of paid search leading to new user signups, etc.

My understanding, is that when creating new contacts programmatically, the source is supposed to be "Offline Sources" [1]. However, HubSpot will automatically associate the browser activity with an identified user later after they have submitted a form, clicked an email link, etc. [2]

[1] https://knowledge.hubspot.com/articles/kcs_article/reports/how-does-hubspot-categorize-visits-contac...
[2] https://knowledge.hubspot.com/articles/kcs_article/contacts/why-did-my-contacts-original-source-type...

However, when I try to use the identify method later in the browser, it doesn't associate the analytics / user behavior with the user contact unless I specify email. Passing id doesn't seem to do the trick. I'd really like to just use the user ID if possible, so I don't need to send the user's email address to my application's frontend.

Is this scenario supported? i.e. a contact already exists, and I call identify from the browser (so all of the tracking cookies are available) to associate browser activity with that contact?

From the documentation at https://developers.hubspot.com/docs/methods/tracking_code_api/identify_visitor, it sounds like passing the contact's ID in an id field will do this. But after I do this, and refresh the contact's details in HubSpot, I don't see the browser activity. It is only after I call identify passing both id and email that I see that data gets associated.

Could it be I'm doing something wrong in my configuration? Or just misunderstanding what the API can do?

0 Upvotes
1 Reply 1
cbarley
HubSpot Alumni
HubSpot Alumni

Associating analytics with Contact without form submission

Hey @Chris_Smith, welcome! Thanks for including all this info. The ID property you can include is this is treated as a completely external identity, so while analytics data can be associated with a specific contact record by the id (if, for example, you've previously identified a record by id and by email, or the record was previously identified by id and the visitor also has a form submission), the contact record cannot be looked up by this id. I think the issue is that you're trying to identify the contact via the vid (the ID that appears in the URL bar when looking at a contact), but this won't work.

The use case for using the ID property would be if you have an external system that has an ID for a contact and you may or may not have their email address in HubSpot (like a sign in flow). You can use the known value of their ID to identify the contact and attribute their page views etc to it. If they convert on a form later, you can then know who the visitor is in both HubSpot and your external system.

Therefore, Identify calls will only yield results in HubSpot if you push email into the _hsq array. I definitely understand your aversion to using email because of security, but at this time, that's the way the call must be formatted.