Link classes dimension
Link classes is the dimension that records the value of a clicked link's class attribute. GA4 enhanced measurement passes it as link_classes on the outbound click event. Because design systems assign consistent classes to button variants, this field lets you group clicks by component type — for example every 'btn-primary' — without rewriting every link. It is empty when the clicked element carries no class attribute.
What this means
When enhanced measurement fires an outbound click event, it includes link_classes — the raw class attribute of the anchor. The link classes dimension exposes that string so you can filter or group clicks by the CSS classes your design system applies.
This is a lightweight way to analyse clicks by component without instrumenting each button individually.
How to use it well
Because link_classes is a space-separated list, exact-match filters can miss links that carry extra classes; use 'contains' filters for a single token like 'btn-primary'. Consistency depends entirely on your markup — if class names drift across pages, the grouping fragments.
Keep class naming stable, or fall back to explicit events when you need a reliable component label.
- Populated by enhanced-measurement outbound 'click'
- Holds the raw class attribute string
- Use 'contains' filters for one class in a list
How it appears in analytics and logs
A link classes value is the clicked element's class string. Blank link_classes means the link had no class attribute, so styling was inline or inherited.
Diagnostic use case
Use link classes to roll up outbound clicks by design-system component, such as all primary buttons, when your markup applies consistent CSS classes.
What WebmasterID can help detect
WebmasterID can record the clicked element's class as event context, so component-level click analysis works without third-party tracking.
Common mistakes
- Using exact-match filters on a multi-class attribute.
- Assuming link_classes is stable when class naming changes per page.
- Expecting a value for links with no class attribute.
Privacy and accuracy notes
Link classes records markup metadata, not a person. WebmasterID treats class attributes as first-party UI context, never as an identifier.
Related pages
- Link text dimension
Link text is the dimension holding the human-readable label a visitor clicked — the words inside the anchor element. In GA4 it is populated by the enhanced-measurement click event as the link_text parameter alongside link_url and link_domain. It is useful for telling apart several links that point to the same destination, but it is empty when the clickable element wraps an image or icon with no text node.
- Link ID dimension
Link ID is the dimension that records the value of a clicked link's id attribute. GA4 enhanced measurement passes it as link_id on the click event. Because an HTML id is meant to be unique within a page, it is the most precise way to identify exactly which link was clicked — more reliable than text or class. It only has a value when the clicked element actually carries an id, which many links do not.
- The click event and outbound clicks
A click event records that a visitor activated a link or element. The most common analytics use is the outbound click — a click on a link leaving your domain — which a normal page_view can never capture because the destination is another site. This page covers what to record on a click, how outbound detection works, and which properties stay privacy-safe.
- CTA tracking
Group clicks by component class first-party.
Sources and verification notes
- Google Analytics Help — [GA4] Enhanced measurement eventsDocuments the click event and link_classes parameter.
Last reviewed 2026-06-24. Facts are checked against primary/official sources where available; uncertain specifics are marked “Data not yet verified” rather than guessed.