Event Tracking for WhatsApp Button with Click to Chat Plugin in Google Analytics

The Click to Chat plugin seamlessly integrates with our existing Google Analytics setup to track user interactions effectively. When a user clicks on the WhatsApp button, an event is triggered and sent to Google Analytics. Please note that the plugin itself does not install Google Analytics, but it is fully compatible and works with any pre-configured setup.

Customizing Event Tracking

We can customize the events directly from the plugin settings to modify the tracking based on our specific requirements.

Event Configuration

  • Event Name: click to chat

This is the identifier under which the event will appear in our Google Analytics reports.

Event Parameters

Event parameters provide additional context about the event, helping us better understand user behavior.

Common Parameters:

  • {title} – Page title where the event was triggered
  • {url} – Current page URL
  • {number} – WhatsApp number used in the widget
  • [gclid] – Google Ads click ID, fetched from the URL
  • [[ _ga ]] – Google Analytics client ID, fetched from the browser cookies

These placeholders can be used in our event label or value fields to dynamically capture useful data during each interaction.

Fetch URL Parameter Values

We can capture values from URL parameters to add more tracking data.

Syntax:

[parameter_name] (enclose the parameter name in square brackets)

Behavior:

  • Returns the value of the specified parameter if found
  • Returns an empty string if the parameter is not present

Example Table for URL Parameters

ScenarioURLInput (Query Params to Extract)Expected OutputExplanation
Examplehttps://example.com?gclid=123abc&utm_source=google[gclid], [utm_source]123abc, googleBoth parameters are present in the URL, so their values are returned.
Edge Casehttps://example.com?utm_source=google[gclid]"" (empty string)gclid is missing from the URL, so an empty string is returned.

Fetch Cookie Values

We can also fetch values directly from cookies for persistent tracking.

Syntax:

[[cookie_name]] (enclose the cookie name in double square brackets)

Behavior:

  • Returns the cookie value if available
  • Returns a blank string if the cookie does not exist

Example Table for Cookie Values

ScenarioURLInput (Query Params to Extract)Expected OutputExplanation
Examplehttps://example.com?gclid=123abc&utm_source=google[gclid], [utm_source]123abc, googleBoth parameters are present in the URL, so their values are returned.
Edge Casehttps://example.com?utm_source=google[gclid]"" (empty string)gclid is missing from the URL, so an empty string is returned.

By implementing this setup, all relevant data related to the “Click to Chat” event will be captured, providing valuable insights into user interactions.

Real-Time Event Monitoring

To monitor user activity as it happens:

  • Log in to our Google Analytics dashboard.
  • Navigate to Reports → Realtime overview → Events(Event Count & Key Events).

  • We will see live event triggers when users click the WhatsApp button on our site.

By configuring event tracking with Click to Chat and Google Analytics, we can gather valuable insights into user behavior, campaign performance, and conversion opportunities—without writing custom code. This allows for smarter decisions and better engagement strategies using accurate real-time and historical data.

Create Event from Google Tag Manager using dataLayer – send to Google analytics – Click to Chat