DEV Community

Rahil Khan
Rahil Khan

Posted on

Which visits turn into calls? Track WhatsApp and phone clicks in GA4 (15-minute setup)

Most small-business sites have analytics installed, but nobody knows which visits actually turned into a call or a WhatsApp chat. Page views don't pay the bills. Clicks on "Call" and "WhatsApp" do.

What to do (Google Analytics 4, about 15 minutes)

  1. Give your contact links a clear marker, e.g. <a href="tel:+15551234567" class="track-call"> and <a href="https://wa.me/15551234567" class="track-wa">.
  2. Fire an event on click:
<script>
document.addEventListener('click', function (e) {
  var a = e.target.closest('a.track-call, a.track-wa');
  if (!a || typeof gtag !== 'function') return;
  gtag('event', a.classList.contains('track-call') ? 'click_call' : 'click_whatsapp', {
    link_url: a.href,
    page_path: location.pathname
  });
});
</script>
Enter fullscreen mode Exit fullscreen mode
  1. In GA4 go to Admin, Events, and mark click_call and click_whatsapp as key events.
  2. After a week, check which pages and traffic sources produce those clicks. That's where to spend effort.

No GA4? Plausible, Umami and similar privacy-friendly tools support the same custom-event idea.

We set this up on client sites at NEXCOD so owners can see what's working. Studio: https://nexcod.vercel.app · WhatsApp +1 289 902 5119

Top comments (0)