How to Track WhatsApp Clicks in GA4 (Step by Step)

Most Sri Lankan customers enquire on WhatsApp, not forms. Here's how to track WhatsApp button clicks as key events in Google Analytics 4 using Google Tag Manager.

In Sri Lanka, WhatsApp is how customers ask questions, request quotes and book appointments. If your website has a WhatsApp button but you don't track it, you're blind to most of your enquiries, and your SEO reports will undervalue organic search.

Here's how to track WhatsApp clicks in Google Analytics 4.

What we're tracking

A click on any link that opens WhatsApp. These usually look like:

  • https://wa.me/94771234567
  • https://api.whatsapp.com/send?phone=94771234567
  • whatsapp://send?phone=...

We can't see whether the visitor actually sent the message, but the click is a strong intent signal.

1. Install Tag Manager

If you haven't already, create a GTM container and add its code to your site. Add your GA4 configuration tag (the Google tag) with your Measurement ID.

2. Enable click variables

In Variables, Configure, enable Click URL and Click Text.

3. Create a trigger

  • Trigger type: Click - Just Links
  • Fire on: Some Link Clicks
  • Condition: Click URL matches RegEx wa\.me|api\.whatsapp\.com|whatsapp://

4. Create a GA4 event tag

  • Tag type: Google Analytics: GA4 Event
  • Event name: whatsapp_click
  • Event parameters (optional): link_url = {{Click URL}}, link_text = {{Click Text}}, page_location = {{Page URL}}
  • Trigger: the WhatsApp trigger above

5. Test

Use GTM's Preview mode, click your WhatsApp button and confirm the tag fires. Then check Realtime or DebugView in GA4.

6. Publish and mark as a key event

Publish the container. After the event appears in GA4 (it can take up to 24 hours), go to Admin, Events and mark whatsapp_click as a key event.

Option 2: Directly in your site code

If you're not using Tag Manager and your site already loads gtag.js, add a small script:

<script>
document.addEventListener('click', function (e) {
  var a = e.target.closest('a[href*="wa.me"], a[href*="api.whatsapp.com"]');
  if (a && window.gtag) {
    gtag('event', 'whatsapp_click', { link_url: a.href });
  }
});
</script>

Then mark the event as a key event in GA4, as above.

Track phone calls the same way

Create another trigger where Click URL starts with tel: and an event named phone_click. On mobile, many visitors tap your number instead of filling a form.

Make WhatsApp enquiries more useful

  • Pre-fill the message: https://wa.me/94771234567?text=Hi%2C%20I%20found%20you%20on%20Google helps you know the enquiry came from your website.
  • Use different pre-filled messages for different pages or services, so you know what each customer asked about.
  • Count real enquiries each month and compare with clicks.

Reading the results

In GA4, go to Reports, Acquisition, Traffic acquisition and add the key event column for whatsapp_click. Now you can see how many WhatsApp enquiries come from organic search, Facebook, Google Ads and so on.

Need it done for you?

We set up WhatsApp, phone, form and purchase tracking as part of our Google Analytics setup service. See also the full GA4 setup guide.

Prabath Thalangama

SEO consultant and tech lead in Colombo. Google Analytics, Kubernetes (CKA), AWS and Red Hat certified.

Want this done for your site?

Get a free SEO audit with a written summary in 3 working days.

Get a free audit
WhatsAppFree audit