Provide 24/7 affordable customer service with AI-powered chat.
Connect to learn more

Setting up the GA4 integration with Google Tag Manager

If you're using Google Tag Manager (GTM) to load your GA4 tag, you'll need to do some additional setup to track Olark events in GA4.

This article assumes you've already:

  • set up your GTM container
  • installed GTM on your website
  • are using GTM to load your GA4 script on your website

Getting started

Log in to your Google Tag Manager dashboard and select the Container you've installed on your website.

In the Variables tab, set up the variables

Each variable should be the "Data Layer Variable" type.

The variable name should be the same in both name fields. Take care that they match the following names exactly:

  • agent_name
  • initiated_by
  • seconds_until_first_reply
  • has_engaged_via_olark
  • most_recent_olark_agent
  • received_outreach_via_olark
Google Tag Manager - User Defined Variables

In the Triggers tab, set up the triggers

Each trigger should be the "Custom Event" trigger type.

Set each trigger to fire on All Custom Events.

The trigger name should be the same in both name fields. Take care that they match the following names exactly:

  • olark_agent_sent_message
  • olark_bot_sent_message
  • olark_conversation_started
  • olark_visitor_sent_message
  • olark_visitor_sent_offline_message
Google Tag Manager - Triggers

In the Tags tab, create a tag with these settings

  • Tag type: Google Analytics: GA4 Event
  • Configuration tag: None - Manually Set ID
  • Measurement ID: copy your GA4 measurement ID here, it should start with a G-
  • Event Name: click the building block icon and choose the "Event - Custom Event" option.

In the Event Parameters section, click the building block icon and add the following variables that you set up previously:

  • agent_name
  • initiated_by
  • seconds_until_first_reply

In the User Properties section, click the building block icon and add each of the following variables:

  • has_engaged_via_olark
  • most_recent_olark_agent
  • received_outreach_via_olark

In the Triggering section, choose each of the following firing triggers that you set up previously:

  • olark_agent_sent_message
  • olark_bot_sent_message
  • olark_conversation_started
  • olark_visitor_sent_message
  • olark_visitor_sent_offline_message

It should look like this:

Google Tag Manager - Tag set up

Save and preview your changes

  • Click "Save" in the upper right of the screen
  • You can use the "Preview" function in GTM to confirm that Olark chats are firing your tags and the events are being routed to your GA4 property.

Publishing your changes

  • Once you've confirmed the tags are set up and working make sure you click SUBMIT in GTM to publish the tag set up to your website.
Please provide the domain name where your Olark live chat is installed.
Include the relevant transcript URL, if possible. You can send us the specific URL from your Transcripts page.
If you see specific error messages, banners, warnings, notices, etc., please let us know here.
Max file size 10MB.
Uploading...
fileuploaded.jpg
Upload failed. Max size for files is 10 MB.
Thank you! Your submission has been received and you'll hear from us shortly!
Oops! Something went wrong while submitting the form.