WhatsApp Button on Your Website: Pre-Filled Messages and Lead Tracking in GA4

IM Host Editorial4 min read
WhatsApp button with GA4 lead tracking

In Egypt and the Gulf, many customers would rather send a WhatsApp message than fill in a form. A WhatsApp button can easily become your biggest source of leads, but most sites cannot tell which page, campaign or product produced each chat. Analytics sees a click, then the conversation disappears into the app. This guide shows how to add a WhatsApp button that sales can use and how to track it properly in Google Analytics 4.

The official click-to-chat format is:

https://wa.me/201XXXXXXXXX?text=Hello%2C%20I%20want%20a%20quote%20for%20...

  • Use the full international number without the plus sign, leading zeros, spaces or dashes (Egypt: 20 followed by the number without its first 0).
  • URL-encode the message text (spaces become %20).
  • Pre-fill a message that tells sales what the customer was looking at: product name, service or page.

Step 2: Add a reference code to every message

UTM parameters do not travel into WhatsApp, so once the chat starts you lose the source. The simple fix is a short reference in the pre-filled text, generated per page or campaign:

Where the button isPre-filled text example
Product page"Hi, I'm interested in Linen Shirt - White (ref P-1042)"
Service page"Hello, I'd like a quote for sea freight (ref S-SEA)"
Ad landing page"Hi, I saw your Ramadan offer (ref AD-RMD)"

Sales can log the reference in the CRM or a sheet, so you can count leads and sales per campaign even if analytics only sees the click. Customers can edit the text, so treat the reference as a strong hint, not perfect data.

Step 3: Place the button where decisions happen

  • A floating button on mobile, bottom corner, that does not cover the add-to-cart or menu.
  • Inline buttons next to prices, on product pages and after FAQs.
  • On the contact page, together with phone and form, with working hours stated.

Load chat widgets lightly. A plain link with an icon is faster than a heavy third-party widget.

Step 4: Track clicks in GA4 with Google Tag Manager

  1. In Tag Manager, enable the built-in Click URL variable.
  2. Create a trigger: Click - Just Links, firing on some link clicks where Click URL contains wa.me or api.whatsapp.com.
  3. Create a GA4 Event tag. Use generate_lead (a GA4 recommended event) or a clear custom name like whatsapp_click, with parameters such as method: whatsapp and link_location (header, product, floating).
  4. Preview and test on desktop and mobile, then publish.
  5. In GA4 Admin, mark the event as a key event (GA4's current name for conversions) so it appears in reports and can be imported into Google Ads.

Without Tag Manager, you can call gtag('event','generate_lead',{method:'whatsapp'}) from the button's click handler.

Step 5: Send the same signal to your ad platforms

  • For Meta ads, fire a Contact or Lead event on the click. If you use the Conversions API, see Meta Pixel and Conversions API setup for deduplication.
  • For Google Ads, import the GA4 key event or create a click conversion.
  • Remember a click is not a lead yet; many people click and never send. Compare clicks with the chats sales actually receives.

Step 6: Measure what matters

MetricWhere it comes from
WhatsApp clicks per page and campaignGA4 event with page and source
Chats started per reference codeSales log or CRM
Deals closed per reference codeCRM
Response timeWhatsApp Business app or platform reports

WhatsApp Business app or platform?

The free WhatsApp Business app suits one or two people handling chats on a phone, with quick replies and labels. When several agents share one number, or you want chats to flow into a CRM automatically, you need the WhatsApp Business Platform through an approved provider. Bots and integrations that run 24/7 need a server; see hosting a WhatsApp bot 24/7.

Checklist

  • wa.me link in international format with pre-filled text
  • Reference code per page or campaign
  • Button visible on mobile without covering key actions
  • GA4 event marked as key event; tested in preview
  • Sales logs reference codes and outcomes

Pair the button with a strong Google profile (Google Business Profile optimisation) and focused landing pages. Want us to set up WhatsApp tracking on your site? Contact our team.

IM Host EditorialNovember 25, 2026All articles