Tag Manager Trigger Chat Completed


#1

Hi
i need help.

How can i create a trigger from chat completed in Google Tag Manager or Javascript?
It’s posible?
Need create a trigger.
Collect generate a automatic Event Analytics, but not generate a dataLayer (for Tag Manager)…

Thanks


#2

You will need a bit technical knowledge for doing this. Here are the steps

  1. Create a custom variable using our cookie ‘collect_chat_completed’ .

https://help.collect.chat/article/show/81158-cookies-and-variables

Above guides might help you to create a variable using the cookie we set during chat completion.

  1. Now using this variable, create a trigger with trigger type ‘Custom events’ > ‘Some custom event’

Hope I explained the steps correctly.

Let me know if this worked for you. If you face any difficulty, feel free to reply :slight_smile:


#3

the images have been removed, can you advise what the name of the custom dataLayer event is that your system generates when the cookies are written?


#4

Hi Henrik,

What do you mean by custom data layer event? If you can elaborate about it, I can help.


#5

In Google Tag Manager – a Custom Event can be built that can be used to fire tags with, such as Google Analytics Event Tags to track certain actions such as chat window opens or closes. Custom Events in GTM are built by referencing the “event” key inside the window.dataLayer object. Hence, As a GTM user I would be attempting to find which details CollectChat are pushing into the dataLayer. Usually pushing details into the dataLayer following this format, perhaps something that Collect Chat can consider adding into the code to be done automatically on each collectchat interaction - example of code that could be executed on collectchat window open:

window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  'event': 'collectchat window open'
});

If that above code would be automatically executed by the collectchat plugin, intergration with Google Tag Manager would be super simple – I would just need to create a GTM “Custom Event” inside the GTM interface and enter “collectchat window open” into the criteria box and I can fire tags right away.

Hence my question previously, do you already push details into the dataLayer or is this that you can add to the plugin to be done automatically – if so you would make life easier for all the users using GTM.


#6

Hi Henrik,

Thank you for the detailed explanation.

We have added data layer variable for our existing google analytics events

Event triggered on widget open
{
“event”: “CollectChatView”
“page”: “”
}

Event triggered on each message

{
“event”: “CollectChatMessage”
“page”: “”
}

Event triggered on conversation complete
{
“event”: “CollectChatComplete”
“page”: “”
}

Please try it out and let us know if it works for you.

Cheers,
Shyjal