Event tracking is an analytics method that measures specific user actions on a website or app - button clicks, form submissions, video plays, file downloads, and more - as individual events. It captures detailed in-page user behavior that page views alone cannot reveal.
Google Analytics 4 (GA4) adopts an event-based measurement model, recording all user interactions as "events." There are three types: automatically collected events (page_view, scroll, click, etc.), recommended events (login, purchase, sign_up, etc.), and custom events (arbitrary events you define yourself).
Click measurement for shortened URLs is a classic use case for event tracking. URL shortening services record an event each time a link is clicked, accumulating data on click counts, the clicker's country, device, browser, and click timestamp. Combined with GA4 event data, this enables end-to-end analysis from click through to post-click user behavior (page views, conversions, etc.).
In GA4, event tracking is implemented using the gtag.js gtag('event', ...) function. For example, to measure CTA button clicks, you would add gtag('event', 'cta_click', {button_text: 'Sign Up Now'}) to the button's onclick handler. Google Tag Manager (GTM) lets you configure events without editing code directly.
A critical aspect of event design is defining the events to track in advance and maintaining consistent naming conventions. Adding events ad hoc leads to scattered data that is difficult to analyze. It is recommended to standardize event names in snake_case and document parameter types and value ranges. Related books are also available on Amazon.