Skip to content
Tag Manager Training
GTM & GA4 glossary

GTM glossary

CSS selector

A pattern that picks out elements on a web page, such as #signup-button or .cta. GTM uses CSS selectors to target clicks and visibility on specific elements.

Also known as: Matches CSS selector, Element selector

On this page
  1. In plain English
  2. Example
  3. Official documentation
  4. Related terms

In plain English

Websites use CSS selectors to style elements. GTM borrows the same patterns so a trigger can say "this exact button".

The most common ones:

  • #contact-form matches the element with the ID contact-form
  • .btn-primary matches elements with the class btn-primary
  • a[href^="tel:"] matches links whose address starts with tel:
  • [data-track="hero-cta"] matches an element with that data attribute

To find an element's ID or class, right-click it in Chrome, choose Inspect and look at the highlighted HTML.

Example

In a click trigger, the condition Click Element matches CSS selector .pricing-card a tracks clicks on any link inside a pricing card. Clicks often land on an icon or text inside the link, so .pricing-card a, .pricing-card a * catches those too.

Official documentation

Last reviewed

Next step

Want your team to know this without looking it up?

Hands-on Google Tag Manager and GA4 training for agencies and marketing teams in Brisbane, the Gold Coast and the Sunshine Coast.