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

When users click on the WhatsApp button, an event is sent to Google Analytics. The plugin itself does not install Google Analytics but works with your existing setup to track events based on the plugin’s settings.

We can customize these events through the plugin’s settings to ensure they track user interactions as desired.

Event Configuration:

  • Event Name: click to chat
    This is how the “Click to Chat” event will appear in your Google Analytics reports.

Event Parameters:

Event parameters are extra details that help provide more context about the event.

Advanced Configuration:

You can customize the data sent with the event using placeholders like:

  • {title} – the page title
  • {url} – the current page URL
  • {number} – the WhatsApp number used by the widget
  • [gclid] – the Google Ads click ID from the URL
  • [[_ga]] – the Google Analytics cookie value

You can also add more tracking details from URL parameters or cookies:

Fetch URL Parameter Values:

  • Syntax: Enclose the parameter name in a single square bracket [parameter_name].
  • If the parameter is found, return its value.
  • If the parameter is missing, return a blank string.

Example:
URL: https://example.com?gclid=123abc&utm_source=google
Input: [gclid][utm_source]
Output: 123abcgoogle

Edge Case:
URL: https://example.com?utm_source=google
Input: [gclid]
Output: "" (blank, since the parameter gclid does not exist)

Fetch Cookie Values:

  • Syntax: Enclose the cookie name in double square brackets [[cookie_name]].
  • If the cookie is found, return its value.
  • If the cookie is missing, return a blank string.

Example:
Assume cookie _ga is set to GA1.2.3456789.1234567890
Input: [[ _ga ]]
Output: GA1.2.3456789.1234567890

Edge Case:
If _ga cookie does not exist:
Output: "" (blank)

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

How to View Real-Time Events

To see real-time user interactions as they happen:

  1. Log in to Google Analytics.
  2. Navigate to Real-Time -> Events.

This section shows events being triggered as users click on the WhatsApp button in real-time.

How to View Recorded Events

To analyze past event data, follow these steps:

  1. Go to BEHAVIOR -> Events -> Overview in the Google Analytics dashboard.
  2. Here, all recorded events will be listed, showing insights like the number of interactions, event actions, and event labels.

Create Event from Google Tag Manager using dataLayer – send to Google analytics – Click to Chat (holithemes.com)