How to use the Event Tracking Script Generator
- Tick the analytics tools your site already loads, and the automatic events you want.
- Copy the script into your footer code (Webflow: Site settings → Custom code → Footer code).
- Add
data-track="event_name"to any button, link or form, plusdata-track-*attributes for parameters. - Use Try it to see the events, then publish and check them in your analytics tool’s live view.
How it works
The script listens once on the whole page, so it also catches elements added later — CMS lists, tabs, popups. When someone clicks an element with data-track (or anything inside one), it reads the event name and every data-track-* attribute as a parameter: data-track-location="hero" becomes location: "hero". On a <form> it fires when the form is submitted rather than on every click. Field values are never read, so no personal data is sent.
What each tool receives
- GA4:
gtag('event', name, params). Tag Manager:dataLayer.push({ event: name, ...params }). - Meta Pixel:
fbq('track', …)for standard events such asLeadorContact(set them withdata-track-meta="Lead"), otherwisetrackCustom. - Plausible, Umami, PostHog, Mixpanel and Fathom get their own event calls with the same name and properties; Clarity gets a custom event to filter recordings by.
Automatic events use GA4’s names — click with outbound: true for outbound links and file_download for downloads — so they line up with Enhanced Measurement if you use both (turn one of them off to avoid counting twice). Tools that are not on the page are skipped silently. Build single events by hand with the GA4 Event Code Generator.
Also searched as: event tracking script, click tracking script, data attribute tracking, webflow event tracking, track button clicks google analytics, ga4 click tracking, outbound link tracking, track form submissions ga4.
Tools that pair well with the Event Tracking Script Generator
- Cookie Consent Banner Generator — Add a cookie consent banner to any site — Webflow, WordPress, Shopify or plain HTML — without a paid plugin.
- dataLayer Push Generator — Build dataLayer.push() code for Google Tag Manager: choose a GA4 recommended event or your own, add parameters and ecommerce items, and optionally wrap it in a click or form submit listener — ready to paste.
- UTM Builder — Add utm_source, utm_medium, utm_campaign and friends to any link, see which GA4 channel the visit will land in, and tag a whole list of URLs at once.
- GTM Snippet Generator — Enter your GTM container ID and get the Google Tag Manager install code for the <head> and <body>, with Consent Mode v2 defaults placed before the container so every tag inside it waits for consent.