How to Track WhatsApp Button Clicks with Google Tag Manager

Track WhatsApp button clicks with Google Tag Manager: a link-click trigger for wa.me links, and a custom event that also catches Click to Chat and Joinchat.

Updated Oct 9, 2026 4 min read
On this page
  1. Two ways to track WhatsApp clicks in Tag Manager
  2. What you need
  3. Setup 1: a link-click trigger for plain WhatsApp links
  4. Setup 2: a custom event that also catches chat widgets
  5. 1. Install WhatsLink Click Tracker
  6. 2. Add a listener tag
  7. 3. Create two data layer variables
  8. 4. Create the trigger
  9. 5. Send it to GA4
  10. 6. Test and publish
  11. Send the same click to Google Ads or Meta
  12. Mistakes to avoid
  13. Read next
  14. FAQ
  15. Official sources

Two ways to track WhatsApp clicks in Tag Manager

Google Tag Manager has no WhatsApp trigger. You can build one from a link-click trigger, which works for plain wa.me and api.whatsapp.com links. If your site uses a chat widget, you need an event that fires when the widget opens WhatsApp — this guide covers both.

What you need

A Tag Manager container on your site and a GA4 property (or a Google Ads account). For the second setup, the free WhatsLink Click Tracker plugin, version 1.6.0 or later.

Use this if every WhatsApp button on your site is a real link to wa.me or api.whatsapp.com.

  1. In Tag Manager, open Variables → Configure and enable the built-in Click URL variable.
  2. Go to Triggers → New and choose Click – Just Links. Select Some Link Clicks and set Click URL matches RegEx wa\.me|api\.whatsapp\.com.
  3. Go to Tags → New → Google Analytics: GA4 Event. Enter your measurement ID (or pick your Google tag), set the event name to whatsapp_click, and add a parameter link_url with the value {{Click URL}}.
  4. Attach the trigger, save, and test in Preview mode.

The limit: a link-click trigger needs a link. Many chat widgets — Click to Chat, Joinchat, WP Social Chat — show a button that opens WhatsApp from JavaScript, with no link to click. For those, the trigger never fires.

Setup 2: a custom event that also catches chat widgets

The free WhatsLink Click Tracker plugin (1.6.0 or later) detects WhatsApp, Telegram, and phone clicks on links and on chat widgets, and announces each one with a whatslink:click event in the browser. These steps pass it to Tag Manager.

Install and activate it from Plugins → Add New. It needs no settings: it starts detecting clicks right away and keeps its own click log in WordPress.

2. Add a listener tag

Create a Custom HTML tag with this code and the Initialization – All Pages trigger:

<script>
  document.addEventListener('whatslink:click', function (event) {
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
      event: 'whatslink_click',
      whatslink_channel: event.detail.channel,
      whatslink_url: event.detail.url
    });
  });
</script>

Every click now pushes a whatslink_click event to the data layer, with the channel (whatsapp, telegram, or phone) and the clicked link.

3. Create two data layer variables

Under Variables → New → Data Layer Variable, create one with the name whatslink_channel and one with whatslink_url. The steps below call them DLV - whatslink_channel and DLV - whatslink_url.

4. Create the trigger

Under Triggers → New → Custom Event, set the event name to whatslink_click. To track WhatsApp only, choose Some Custom Events with DLV - whatslink_channel equals whatsapp.

5. Send it to GA4

Create a Google Analytics: GA4 Event tag with the event name {{DLV - whatslink_channel}}_click — it becomes whatsapp_click, telegram_click, or phone_click — and a parameter link_url set to {{DLV - whatslink_url}}. Attach the trigger from step 4.

6. Test and publish

Open Preview, click a WhatsApp button on your site, and check in Tag Assistant that whatslink_click appears and your GA4 tag fires once. Then publish the container.

Send the same click to Google Ads or Meta

The trigger from step 4 works for any tag:

  • Google Ads: add a Google Ads Conversion Tracking tag with the conversion ID and label of a conversion action. How to create one is in How to Track WhatsApp Clicks as Conversions in Google Ads and Meta Ads.
  • Meta Pixel: if the pixel is already on your site, a Custom HTML tag with <script>fbq('track', 'Contact');</script> sends the standard Contact event.

Prefer not to maintain tags? WhatsLink PRO sends the same clicks to GA4, Google Ads, and the Meta Pixel from its Ad Conversions page. Use one approach, not both, or each click is counted twice.

Mistakes to avoid

  • Counting twice. If GA4’s enhanced measurement Outbound clicks is on, wa.me clicks also appear as a generic “click” event. That is fine as long as you only mark whatsapp_click as a key event.
  • Firing the listener late. Keep the listener tag on Initialization – All Pages, so it is ready before the visitor clicks.
  • Typos in event names. Names are case-sensitive: whatslink_click in the data layer, whatsapp_click in GA4.
  • Consent. Tag Manager tags follow your consent settings. Clicks from visitors who decline are not sent to GA4 or Google Ads; WhatsLink’s own click log in WordPress still records them, without personal data.

What WhatsLink Click Tracker gives you for free

  • Detects WhatsApp, Telegram, and phone clicks on links and chat widgets
  • A whatslink:click event for Tag Manager or your own code
  • A click log in WordPress with page, link, UTM parameters, and referrer
  • No IP addresses or personal data stored
  • Works with Click to Chat, Joinchat, Chaty, and WP Social Chat
Get WhatsLink free

FAQ

Why doesn't my GTM click trigger fire for my WhatsApp chat widget?

Most chat widgets show a button that opens WhatsApp from JavaScript instead of a link. Click – Just Links triggers only see links, and an All Elements trigger catches the click on the button but not whether it opened WhatsApp. Use an event that fires when WhatsApp is opened, such as WhatsLink's whatslink:click.

Does the whatslink:click event work for Telegram and phone links?

Yes. It fires for WhatsApp, Telegram (t.me), and phone (tel:) clicks, with the channel in event.detail.channel. Filter on it in your trigger if you only want WhatsApp.

Will the click be counted twice?

Only if two setups send the same event. Don't combine a link-click trigger and the custom event for the same GA4 event name, and don't add GTM tags for clicks that WhatsLink PRO's Ad Conversions already sends.

Can I send WhatsApp clicks to Google Ads from Tag Manager?

Yes. Use the same trigger with a Google Ads Conversion Tracking tag and the conversion ID and label of a conversion action in your Google Ads account.

Do I need Tag Manager to use WhatsLink?

No. WhatsLink Click Tracker logs clicks in WordPress on its own. Tag Manager is only needed to pass the clicks to other tools, and WhatsLink PRO can do that without it.

Does the listener slow down my site?

No. It is a few lines that wait for a click; nothing runs until a visitor clicks a WhatsApp, Telegram, or phone link.

Official sources

Related guides