Webflow sync, pageviews & more.
NEW

How do I track button clicks on my website using Google Analytics and Webflow?

TL;DR
  • Add Google Tag Manager to your Webflow site via the project’s custom code settings.
  • In GTM, create a click trigger targeting your button and a GA4 event tag with desired parameters.
  • Test with GTM’s preview mode, then publish changes and verify events in GA4’s Realtime report.

To track button clicks on your Webflow site with Google Analytics, you’ll use Google Tag Manager along with tags and triggers configured for click events.

1. Install Google Tag Manager in Webflow

  • Create a Google Tag Manager (GTM) account at tagmanager.google.com.
  • Copy the GTM container ID (e.g., GTM-XXXXX).
  • In Webflow, go to Project Settings > Custom Code > Head and paste the GTM <head> code snippet.
  • Then, under “Before tag”, paste the GTM <body> snippet.
  • Publish your site to apply the changes.

2. Set Up Click Trigger in Google Tag Manager

  • In GTM, go to Triggers and click New.
  • Choose Trigger Type → Just Links or All Elements (depending on whether the button is a link or a div/button).
  • Select “Some Clicks” and define conditions like:
  • Click Classes contains "btn-primary", or
  • Click Text equals "Sign Up".
  • Give the trigger a name (e.g., "Sign Up Button Click") and save.

3. Create a Google Analytics Event Tag

  • Go to Tags, then click New.
  • Choose Tag Type → Google Analytics: GA4 Event.
  • Select your GA4 Configuration tag or enter your Measurement ID.
  • Define the event name, e.g., button_click, and optional parameters:
  • event_category: "Button"
  • event_label: "Sign Up Button"
  • Under Triggering, add the click trigger you created in Step 2.

4. Preview and Test in GTM

  • Click Preview in GTM and enter your site’s URL.
  • Click the button on your site to test.
  • In the Tag Assistant Preview, confirm that the event tag fires when the button is clicked.

5. Publish Your GTM Changes

  • Once verified, return to GTM and click Submit → Publish to make the changes live.

6. Verify in Google Analytics

  • Go to GA4 > Reports > Realtime to confirm that the event is tracked live when someone clicks the button.

Summary

To track button clicks in Webflow using Google Analytics, embed Google Tag Manager in your site, then use click-based triggers and GA4 event tags in GTM to send click data to Analytics. This method provides flexibility and doesn’t require custom code on each button.

Rate this answer

Other Webflow Questions