Invalid CSS Selectors in Triggers
One or more Click or Element Visibility triggers use CSS selectors with syntax errors. Unclosed brackets, malformed pseudo-classes, or unescaped special characters. Invalid selectors do not match anything at runtime, so the trigger never fires and any tag dependent on it is dead.
Why It Matters
GTM's Click and Element Visibility triggers accept a CSS selector as their match target (`Click Element matches CSS selector`). The browser evaluates the selector against the DOM at trigger time. If the selector is malformed. `button[data-id="cta]` with an unclosed quote, `.cta:hov` with a typo in the pseudo-class. The browser throws an error and the trigger fails to match. The tag wired to that trigger never fires, and the audit dashboard shows it as "passed" because no errors were logged. The most common pattern is a copy-paste from a developer Slack message where the selector was abbreviated or wrapped, breaking the syntax. AdLint validates the selector syntax statically; the check is high-signal because invalid selectors are nearly always bugs, not intentional configurations.
How To Fix It
- AdLint's details list each affected trigger and its invalid selector.
- Open each trigger in GTM and inspect the selector field.
- Validate the selector. Paste it into your browser's DevTools console: `document.querySelector("your-selector-here")`. If it throws, the syntax is broken.
- Common fixes: balance quotes and brackets, escape colons and other special characters in attribute values (`[data-test="user\:profile"]`), and check pseudo-class spelling (`:hover` not `:hov`).
- After fixing, complete a test interaction in Preview mode and confirm the trigger now matches. Publish.
Example
Invalid: button[data-cta="signup
Fixed: button[data-cta="signup"]
Invalid: .nav-link:hov
Fixed: .nav-link:hoverInvalid CSS selectors in one or more GTM Click or Element Visibility triggers. The W3C Selectors specification, browsers reject malformed selectors at evaluation time, causing the trigger to never match. Tags wired to these triggers fail to fire without surfacing any error, producing dead measurement paths invisible in standard reporting. Fix: validate each flagged selector against the live DOM using `document.querySelector` and fix syntax errors. Source: developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors.
Drop this paragraph into your client deliverable. Sources back to the canonical platform documentation linked below.
References
Audit your own files for this check
AdLint runs this check (and 177 others) against your GTM, Google Ads, Meta, TikTok, LinkedIn, Pinterest, Twitter/X, and Snapchat exports. Everything stays in your browser. No uploads, no accounts.
Run a free audit