Dev Request: Dev Request - Chat Contact Associated

Status: Complete
Last updated: November 08, 2022 3:36 PM MST
Originally delivered at: October 28, 2021 6:00 PM MDT

Instructions

Intro

When the Google Tag Manager library loads it declares a global JS object, dataLayer. It overloads the array prototype .push method so that it can grab on to objects/"events" pushed to that array.

Notes/Questions

Ultimately this should include passing web analytics and ads platform ids forward into Hubspot. Currently the chat widget doesn't allow this.

Future Considerations

Notes for Data Collection
  • There is no central "application database". The profile of a user is spread between Hubspot, Chargebee, and Auth0.
  • For the following statuses, we'll be hoping for the Hubspot Contact Id and that Hubspot data can be joined in the warehouse for:
    • has_had_demo_before
    • has_had_trial_before
    • opted_in_to_email_updates
    • is_new_to_file_email_domain
    • is_new_to_file_organization
    • is_new_to_file_email_address
    • new_hubspot_contact_created
Improvements
  • Is it possible to get the Hubspot Contact ID back from HS and then injected into the dataLayer?
    • It doesn't appear to be possible as a response from the HS Forms API, but a second call could be made to the HS Contacts API to get a contact matching the email on the just-submitted form.

Data Layer Event: chat_contact_associated

Triggering Conditions

The chat widget SDK only allows for a non-contact-specific confirmation event, contactAssociated, when a contact is created in chat.

Hence, Javascript in Google Tag Manager subscribes to this event on the SDK and pushes to the data layer when the event fires.

SDK Docs

Event to Log

<script>
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    'event': 'chat_contact_associated',
    'data': {}
  });
</script>

Description of Data Fields

chat_contact_associated

Validation Schema does not have properties

JSON Validation Schema

For Super Techies:

The event payload, everything under the data property, will be validated against this schema. For more see JSONSchema standard.

{
  "TBD": "TBD"
}