Sending gclid value to HS when chat conversation started

ilonah
Member

Greetings,

We track chat conversation statutes as events using GTM.

We would like to capture gclid value from cookies and send it to HS when a user starts a conversation (leaves email within the widget and contact is created in HS).

Does anyone have an idea how to do so?

It would help a lot.

Thanks.

 

0 Upvotes
5 Replies 5
IsaacTakushi
HubSpot Employee

Hi, @ilonah.

 

When you say "capture gclid value from cookies," which cookies are you referring to?

 

It is not possible to pull values from HubSpot's analytics cookies, but if you're already storing gclid parameter values in custom cookies, then it might be possible to draw on this and push it into HubSpot with something like the identify function.

Isaac Takushi

Alumnus, HubSpot Developer Support
0 Upvotes
ilonah
Member

Thank you, @IsaacTakushi for your reply. However, I don't think the identify method will work here. The unique identifier is an email address. We don't have user's email in the URL as a query parameter, only gclid and UTM parameters.

The documentation also says that a custom external ID can be used as an identifier.

Assuming that the contact is  created by a chat bot and i don't need to create a contact, just to connect his gclid value with the contact record in HS, how can external ID be used in this case?

Thank you.

 

0 Upvotes
IsaacTakushi
HubSpot Employee

Hi, @ilonah.

 

Ah, so you're referring to retrieving the gclid value from the URL query string (not a cookie) and passing it to the contact record?

 

If you're relying on the chatbot to create a contact record (after capturing their email), then you're correct that the identify function won't work, as it cannot communicate directly with the chatbot and retrieve the necessary email value.

 

If the gclid value exists in the URL, then it will also be automatically stored in the new contact's First page seen (hs_analytics_first_url) property value.

 

You could filter and segment on this single-line text property in HubSpot lists and workflows.

 

If you need the gclid value in its own custom contact property, you could extract the hs_analytics_first_url value with this endpoint, strip the irrelevant parts of the First page seen URL, and place only the gclid value back in its own property via this endpoint.

Isaac Takushi

Alumnus, HubSpot Developer Support
0 Upvotes
ScottAndrews888
Participant

ilonah,

 

Do you mind me asking which chat service you are using?  We are trying to capture GCLID data related to the PPC clicks that result in a chat and send the chat and GLCID data to HubSpot.

0 Upvotes
ilonah
Member

We are using Hubspot chat tool.

We still didn't find an ideal solution.

We use GTM to send an event that somebody started a HS chat conversation and his gclid is known but we don't know how to copy gclid value from 1st party cookies to HS property.

0 Upvotes