Send a custom property to HubSpot via Tracking Code API
SOLVE
Hi,
We're trying to send a custom id to HubSpot for all the users that are visiting the website. Our aim is to have this Id available wherever a contact is created. Unfortunately, many contacts are created via the "Meetings" module thus we're not able to use a hidden field to send this id and ideally we would not like to change the flow.
Currently, using the information from the documentation we're sending this Id in every pageview with the below snippet:
The above should work similarly with the attribution information, as the property should be set as soon as the visitor will reach out and the contact is created.
While this seem to be working for a couple users (even retrospectively - the id is set for users that are already a contact and re-visit the website), there are many (almost all) new contacts that they do not have this custom property set, even though they visited the website. Through our internal tests (visit the website as a new user, browse some pages, book a meeting) we always get this id.
Do we have to do anything further to ensure this Id will be available for any contact? If not, is there another way?
Just to recap, you'd like to pass in internal ID and other properties using the identify a visitor function to store visitor information first. Subsequently, if the visitors submit a form/when the email is available, you'd like to populate the stored visitor information, am I understanding it correctly?
If so, you'd likely need to follow a flow like this:
However, unlike with an email address, including an 'id' by itself will not create a contact. Also, this 'id' 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.
With the above in mind, I'd recommend your team to include the email field when identifying a visitor so that we can ensure all new contacts will be created within HubSpot.
As mentioned, during the visit of the user, their e-mail is not available yet. This is why we try to attach this internal id to their cookie, and as soon as the contact is created at a later time, attribution information (e.g. original source) and our internal id should be available.
I am trying to understand how HubSpot is able to have a visitor's attribution information of their first visit prior to the user giving their e-mail and as soon as the contact is created attach the information. We try to mimic this approach because we're not able to use a hidden field to send the internal id as the "Book a Meeting" module is not supporting hidden fields.
Just to recap, you'd like to pass in internal ID and other properties using the identify a visitor function to store visitor information first. Subsequently, if the visitors submit a form/when the email is available, you'd like to populate the stored visitor information, am I understanding it correctly?
If so, you'd likely need to follow a flow like this:
Indeed what you propose should work flawlessly. In the meantime, we found another way of having visitor information sent to HubSpot without providing the e-mail at all.
As you described, we noticed that if we use the "identify" function after the contact is created, then the information is stored appropriately. Thus, through Google Tag Manager, we're firing the snippet on every form submission and meeting booked. This ensures that the information is sent and it's attached to the contact 99% of the cases.