CTA tracking
Tag CTAs and forms with data-wmid-cta and data-wmid-form so clicks and submissions land as cta_click and form_submit events.
Last updated: v1.5.2 · 2026-05-10
WebmasterID does not guess what counts as a CTA. You mark it explicitly. That keeps event ids stable across redesigns and keeps your analytics legible after six months.
CTA buttons + links
Add data-wmid-cta="<id>" to any element whose click should fire a cta_click event.
<a href="/pricing" data-wmid-cta="hero-pricing"> View pricing </a> <button data-wmid-cta="install-snippet-copy"> Copy snippet </button> <a href="https://apps.apple.com/app/..." data-wmid-cta="app-store-click" > Download on App Store </a>
Combined with outbound / download
When a tagged link is also outbound or a downloadable asset, the tracker fires the more specific outbound/download event AND attaches the CTA id to it. One event per click; the dedupe window is 750 ms.
<a href="https://github.com/PetroTitan/webmasterid" data-wmid-cta="hero-github" > View on GitHub // → outbound_click with cta_id="hero-github" </a> <a href="/whitepaper.pdf" data-wmid-cta="footer-whitepaper" > Download the whitepaper // → download with cta_id="footer-whitepaper" </a>
Forms
Tag the <form> element itself, not the submit button.
<form data-wmid-form="contact" action="/api/contact" method="POST"> <input type="text" name="name" required /> <input type="email" name="email" required /> <button type="submit">Send</button> </form>
- The form's id is the only thing recorded.
- WebmasterID never serialises form field values.
- For a button that should fire
signuporpurchaseinstead ofform_submit, usedata-wmid-eventon the button — see declarative events.
Choosing CTA ids
- Stable + semantic. Pick a name that survives a redesign.
hero-signup,pricing-get-started,nav-docs. - Lowercase, hyphen- or underscore-separated.
hero-pricingbeatsHeroPricingfor dashboard scannability. - Include section context. The same
signupCTA appearing in three places becomeshero-signup,pricing-signup,footer-signup— distinct events, comparable performance. - Maximum length is 128 characters. Aliases
data-cta-idanddata-wmid-event-idwork too.
Never put in a CTA id
- No PII. No email addresses, no names, no phone numbers.
- No internal user IDs / order IDs / session tokens. Those belong on the server, not in click telemetry.
- No keyword stuffing. Don't pack a paragraph of SEO copy into a CTA id. It hurts your own analytics.
- No consent state. A consent token in a CTA id is a privacy footgun.
Verifying tagged events
- Open the page, click the tagged element, then check
/eventson the dashboard. The new event row should appear within seconds with the CTA id you used. - The 750 ms dedupe window prevents double-clicks from double-counting. If you genuinely want two events from one interaction, use two separate CTA ids on two elements.
Related
- /docs/events — full event vocabulary including signup / purchase declarative events.
- /docs/install — install the tracker first.
- /docs/privacy — what to disclose in your own privacy notice.