Connect Google Tag Manager

|

View as Markdown

Use Google Tag Manager(opens in new tab) to manage your website tags without editing code. Infobip Live Chat supports this tag management solution.

If you already use Google Tag Manager on your web pages for other purposes, use it for Live Chat with zero downtime.



Prerequisites [#prerequisites]

You need a Google Tag Manager account and the Google Tag Manager installation on your website. If you do not have one, set it up:

  1. Create a Google Tag Manager account(opens in new tab). Google Tag Manager page for creating an account
  2. Log in to your Google account or create one.
  3. Go to Google Tag Manager(opens in new tab).
  4. Select Create account on the right side.
  5. Enter the name of your account, country, container name, and platform.
  6. Select Create to confirm the configuration.
  7. Read and accept the Google Tag Manager Terms of Service Agreement(opens in new tab).
  8. Install Google Tag Manager on your website by following the instructions in Google Tag Manager. For more information, see the GTM Quickstart documentation(opens in new tab).

After you install Google Tag Manager, connect it to Live Chat.



Load the widget through Google Tag Manager [#load-the-widget-through-google-tag-manager]

Load the Live Chat widget through Google Tag Manager instead of adding the snippet to your website code. To add the snippet directly, see Install the web widget.

To load the Live Chat widget through Google Tag Manager:

  1. Log in to the Infobip web interface and go to Channels and Numbers → Channels → Live Chat. Select your widget or select Create widget.
  2. Expand Installation and security.
  3. In Install Live Chat on your website, select the Google Tag Manager tab. To copy the snippet code, select the copy icon in the top right corner of the code box. Google Tag Manager tab in Install Live Chat on your website with the snippet code and the Open GTM button
  4. Select Open GTM below the snippet code and log in to Google Tag Manager with your Google account.
  5. Under Tags, select New in the top right corner to add a tag. New tag button under Tags in Google Tag Manager
  6. Select the Tag Configuration panel and select the Custom HTML tag type. Custom HTML tag type selected in the Tag Configuration panel
  7. Paste the snippet code from step 3 in the HTML text box. Live Chat snippet pasted into the HTML text box of a Custom HTML tag
  8. Configure the tag firing(opens in new tab) to run when you want on your website. Tag firing options for the Live Chat tag in Google Tag Manager
  9. Configure the triggering.
  10. Save the tag. Save button for the Live Chat tag in Google Tag Manager
  11. Publish the tag. Select Publish and Create Version to push the changes to your sites. Publish and Create Version option in Google Tag Manager


Share events with Google Analytics [#share-events-with-google-analytics]

Use the Live Chat channel to share events with your Google Analytics account. Then track these events in Google Analytics through Google Tag Manager.

The widget pushes every event to the Google Tag Manager data layer as one liveChatInteraction event. The action field shows which action happened. For example, when the end user opens the widget, the widget pushes the following object:

javascript
{ event: 'liveChatInteraction', action: 'widget_open' }

Use the lower-case action values in your Google Tag Manager triggers. Live Chat supports the following actions:

ActionTriggered when
widget_openThe end user selects the widget button and the chat opens.
widget_closeThe end user selects the widget button again and the chat closes.
eye_catcher_engagedThe end user selects the eye-catcher. The eye-catcher is a small bubble-like text next to the widget, if enabled.
eye_catcher_dismissThe end user closes the eye-catcher.
conversation_openedThe end user selects the start chat button.
conversation_solvedThe conversation is solved.
conversation_closedThe conversation is closed.

Configure event tracking [#configure-event-tracking]

If you already integrated Google Analytics and Google Tag Manager on your website, the Live Chat widget automatically sends these events when they are triggered. Otherwise, connect Google Tag Manager and set up Google Analytics(opens in new tab) for your website first.

To configure Live Chat event tracking:

  1. In the Tag Configuration section, integrate Google Analytics with Google Tag Manager. Provide the Measurement ID(opens in new tab) from your Google Analytics account. Google Analytics tag configuration with a Measurement ID in Google Tag Manager
  2. Download the Live Chat container file for Google Tag Manager(opens in new tab). It contains the tag, trigger, and variable required to track Live Chat events.
  3. In Google Tag Manager, go to the Admin panel and select Import container to import the file.
  4. Copy the code snippet that integrates your web application with Google Tag Manager. If you have not done this yet, see Connect Google Tag Manager. Google Tag Manager code snippet for integrating a web application
NOTEThe events can take some time to start registering.


Related pages

Install the web widget
Add the widget snippet directly to your website.

Content Security Policy (CSP) in Live Chat
Load the widget on websites that use a Content Security Policy.

JavaScript SDK in Live Chat
Control the widget from your website code.


Was this page helpful?