Visitors, Contacts and tracking Deals

Hello! My use case is following:

I’m already identifying visitors, specifying email (and other optional identification info) for logged in site users.

Also the site allows to request free samples of production without previous user registration, however we require visitors to enter email and other personal info (name, address etc) to request samples.

If user not registered yet and contact not exists within Contacts on HubSpot, my script creating a new contact using HubSpot API v3. (Plus also creating a Deal with associated Contact. Despite it’s free sample request, it’s Deal anyway, possible first step to further real purchase.)

The problems are…
1. When a Contact creating via API it seems can’t be updated anymore from the front-end tracking JavaScript. No web analytics available for contacts created using API. (Or maybe I’m doing something wrong? Am I missing something to make records created via “integration” to be updated by “analytics”? Email is correct, I checked multiple times. The Contacts created via API just not tracked, although we really need to track and analyze them.
2. I read other questions to community and I see that there is no way to assign “hubspotutk” cookie to the Contact. But how can I tie the Contacts created via API on my site’s backend with site visitors?

Again, the problem is that not all visitors are logged-in when submitting the sample request form. So they are not identified yet, their Contact is not yet created. Although visitors are certainly tracked, they have info about referrer, details like “utm_source” etc. I thought to sign-up them first, then redirect to another page which will able to make visitor identification with submitted email, but the problem is that HubSpot Analytics is often delayed(!!). The Contact with web analytics may be not available yet via API when I’m creating a Deal. So since the Contact not exists, I have to create a new Contact, which does not contain any tracking information, so the Deal (Sale) is missing for analytics :disappointed_face:
Please help!

Hi @utilmind,
Thank you for reaching out to the Community!
Once the contact is created, if you’d like to update it via API, here is the endpoint you can try: “Update an existing contact”.
Are you using a HubSpot form or an external form?
Is the website hosted in HubSpot or is it an external website?
What is the name of the property you are trying to update regarding site visitors?
I’d like to share these articles that might help you:
- Install the HubSpot tracking code
- Use non-HubSpot forms
- Properly identify source of contacts added via API (currently most attributed to “offline source”)
I also wanted to invite a couple of subject matter experts to this conversation: @zach_threadint, @Teun and @HubSpot_Corey do you have suggestions to help @utilmind, please?
If anybody else has anything to add and/or share, please feel free to join in the conversation :slightly_smiling_face:
Thank you very much and have a great day!
Best,
Bérangère

Hi @utilmind and thanks for the tag @BérangèreL

I might be oversimplifying things here but is there any reason you aren’t using a HubSpot form to request the free trial? This could potentially provide a straightforward solution as the forms would automatically create any contacts and also help handle the cookie requests. I’ve outlined this below and included some additional resources.

  1. Automated Cookie Management: When visitors fill out a HubSpot form, the HubSpot tracking code automatically manages the hubspotutk cookie. This cookie is essential for linking the form submission with the visitor’s current browser session, or initiating a new session if one doesn’t exist.
  2. Contact Creation and Update: If the visitor doesn’t have an existing contact record in HubSpot, the form submission will trigger the creation of a new contact automatically. If a contact record already exists, it can be updated with the new information provided through the form. This ensures that all contact data is accurate and up-to-date.
  3. Seamless Event Tracking: Once the hubspotutk cookie links a visitor’s session to their contact record, any future interactions with your site (such as additional form submissions, page views, or other engagement) will be automatically tracked and recorded under their contact. This enhances your ability to follow up on potential leads and understand visitor behaviors in-depth.
  4. Simplification of Integration: Using a HubSpot form simplifies the integration process by naturally fitting into the HubSpot ecosystem, including analytics and CRM functionalities. This method reduces the need for custom coding or API manipulation just to align basic tracking and contact management processes.

Additional Resources

HubSpot Knowledge Base - Cookies set in a visitor’s browser by HubSpot
HubSpot Community - Properly extracting Hubspot cookie for hutk value

HubSpot Community - Associate Contact Creation with hubspotutk cookie for traffic sources

I did not accept this solution. And response absolutely doesn’t solve my issue.

I’m not using the HubSpot forms. I’m using the regular tracking code (described on https://knowledge.hubspot.com/account-and-setup/topics?hubs_content=knowledge.hubspot.com/reports/install-the-hubspot-tracking-code&hubs_content-cta=kb-breadcrumbs__item#tracking-code).

However I can’t connect visitors (detected on the front end) with the Contacts (sent to the HubSpot API on the backend), because there is no way to connect the Contact with visitors, no identifiers, no hubspotutk cookie. (Again, I don’t use HubSpot forms.)

So the response above did not solve my issue, it’s rather misleading.