Track Chat Interactions and Sales Attribution with Google Analytics

Prev Next

Connect your Gladly Team Chat widget to Google Analytics to see how Customers interact with your support experience. This integration automatically tracks events like when someone opens Chat, sends a message, or completes a Conversation,  giving you insights to improve your service service, as well as attribute sales revenue to Gladly AI.

  • If you are not using Google Analytics, you can still track your data by setting this up manually

What you can track

Once enabled, the Chat widget automatically sends events to your Google Analytics account. You'll be able to see:

  • When customers open or close the chat widget

  • Messages sent and received

  • Conversation starts and ends

  • Quick action button clicks

  • Search result selections

  • Proactive campaign triggers

  • Agent availability changes

All events are prefixed with gladly_ so you can easily filter them in your analytics reports.

Setting up Google Analytics tracking

Enable tracking in Gladly

  1. Click  on the top left corner of the screen.

  2. Click Settings.

  3. Under the Channels category, click Chat. The Chat page will show you a list of Chats you currently have. Select the widget you want to track

  4. Click, then select Configure.

  5. Find the Google Analytics tracking section

  6. Check the box next to Enable Google Analytics Tracking.
    Configuration settings for Google Analytics tracking in chat for sales attribution.

    • Auto-detect Tracking ID (recommended): Gladly automatically finds your GA4 or Google Tag Manager setup on your website.

      • If you uncheck the box next to Auto-detect Tracking ID (recommended), you’ll be able to enter the GA4 tracking id:

        • Custom GA4 Tracking ID: Enter your GA4 Measurement ID manually (looks like G-XXXXXXXXXX)

  7. Click Save

Your updates will go live within five minutes.

Complete your analytics setup

What you do next depends on how your website uses Google Analytics.

  • If you use GA4 directly (gtag.js) – You're all set! Events will automatically appear in your GA4 property.

  • If you use Google Tag Manager – You'll need to configure GTM to send events to GA4. See the detailed instructions below.

Configuring Google Tag Manager

When using GTM, events are sent to your dataLayer but won't appear in GA4 until you create a trigger and tag to forward them.

Create a trigger for Gladly events

  1. In GTM, go to TriggersNew.

  2. Select Custom Event as the trigger type.

  3. Set the event name to: gladly_* (this captures all Gladly events).

  4. Choose All Custom Events that match the pattern.

  5. Name it something clear like "Gladly Chat Events."

  6. Click Save.

Create a GA4 tag

  1. Go to TagsNew.

  2. Select Google Analytics: GA4 Event.

  3. Enter your GA4 Measurement ID.

  4. Set the Event Name to: {{Event}}.

  5. Add event parameters by creating Data Layer Variables for the parameters you want to capture (like event_category, source, text).

  6. Under Triggering, select the Gladly trigger you just created.

  7. Name the tag (like "GA4 - Gladly Chat Events").

  8. Click Save.

Test and publish

  1. Click Preview in GTM to enter debug mode.

  2. Open your website and interact with your chat widget.

  3. Confirm that Gladly events appear in the GTM debugger and fire your GA4 tag.

  4. Once verified, click Submit and Publish.

Verifying your setup

Check events in real-time

Open your GA4 property and go to ReportsRealtimeEvent count by Event name. Look for events starting with gladly_.

Use browser developer tools

  1. Open DevTools (press F12).

  2. Go to the Network tab.

  3. Filter by analytics.google.com/g/collect.

  4. Interact with your chat widget.

  5. You should see network requests containing your Gladly events.

Use Google Tag Assistant

Install the Tag Assistant Chrome extension to see all events firing in real-time and verify parameters are captured correctly.

Events reference

Event name

What it tracks

gladly_sidekick_opened

Customer opens the chat widget

gladly_sidekick_closed

Customer closes the Chat widget

gladly_message_sent

Customer sends a message

gladly_message_received

Message received from Agent or automation

gladly_conversation_started

New conversation begins

gladly_conversation_ended

Conversation closes

gladly_customer_onboarded

Customer completes pre-chat form

gladly_quick_action_selected

Customer clicks a quick action button

gladly_search_result_selected

Customer selects a search result

gladly_campaign_triggered

Proactive campaign fires

gladly_availability_change

Agent availability status changes

Each event includes relevant details like message type, how the widget was opened, or which quick action was selected. For a complete list of properties associated with each event, see the Chat SDK developer documentation.

Good to know

  • Auto-detect works best for most setups. Only use a custom tracking ID if you need to send events to a specific GA4 property that differs from what's on your page.

  • Custom tracking IDs only work with GA4, not Google Tag Manager. If you use GTM, stick with auto-detect.

  • Changes take up to 5 minutes to go live after you save your settings.

  • Customer data is included in some events. The gladly_customer_onboarded event captures the name and email customers enter in pre-chat forms. Make sure this aligns with your privacy policies.


FAQ

Events aren't showing up at all

Confirm tracking is activated in your Gladly Team Chat settings. Check that your GA4 or GTM code is loading on the page before the chat widget

Events appear in GTM but not GA4

  • Verify your GTM trigger matches gladly_*

  • Confirm your GA4 tag is using the correct Measurement ID

  • Make sure you've published your GTM container after making changes

Events show in DevTools but not GA4 realtime

Realtime reports can have a slight delay. Wait a minute and refresh. You can also verify the Measurement ID in your requests matches your GA4 property.

Related resources