On this page
- Two ways to track WhatsApp clicks in Tag Manager
- What you need
- Setup 1: a link-click trigger for plain WhatsApp links
- Setup 2: a custom event that also catches chat widgets
- 1. Install WhatsLink Click Tracker
- 2. Add a listener tag
- 3. Create two data layer variables
- 4. Create the trigger
- 5. Send it to GA4
- 6. Test and publish
- Send the same click to Google Ads or Meta
- Mistakes to avoid
- Read next
- FAQ
- 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.
Setup 1: a link-click trigger for plain WhatsApp links
Use this if every WhatsApp button on your site is a real link to wa.me or api.whatsapp.com.
- In Tag Manager, open Variables → Configure and enable the built-in
Click URLvariable. - Go to Triggers → New and choose Click – Just Links. Select Some Link Clicks and set
Click URLmatches RegExwa\.me|api\.whatsapp\.com. - 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 parameterlink_urlwith the value{{Click URL}}. - 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.
1. Install WhatsLink Click Tracker
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_clickin the data layer,whatsapp_clickin 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.
Read next
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
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.