Skip to content
FunnelGuard

Fix guide by FunnelsGuard

GTM trigger broken by CSS class change after redesign: fix

TRK-108High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

A GTM trigger is the rule that says when a tag should fire. Many click and form triggers use a CSS class (a label in the page's HTML used for styling), for example Click Classes contains `btn-primary` or a Click - Just Links trigger with the condition Click Element matches CSS selector `.hero-cta`.

How a renamed class breaks tracking
  1. Visitor clicks buttonButton now has class button--solid
  2. GTM trigger checks classLooks for btn-primary, finds none
  3. Tag firesNever runs
  4. Conversion in GA4 / adsNever recorded

The visitor journey is fine. Only the tracking step fails, so every later report step is empty.

Why it costs you leads or sales

Recorded conversions per week around a redesignExample numbers
Recorded conversions per week around a redesign (example)Week before: 42 conversions; Redesign week: 3 conversions; Week after: 2 conversions016324232Week beforeRedesign weekWeek afterconversions

Example: real leads stay steady, but recorded conversions fall to near zero in the week the class is renamed.

How to check if your site has it

Test the trigger in GTM Preview
  1. Open Preview modeGoogle Tag Manager

    In GTM click Preview, enter your page URL and connect Tag Assistant.

  2. Do the action

    Click the button or link the trigger is meant to track on the live, redesigned page.

  3. Check the event summaryGoogle Tag Manager

    In Tag Assistant select the click event on the left. Under Tags, see whether your tag is listed as Fired or Not Fired.

  4. Compare the classGoogle Tag Manager

    Select the Variables tab for that click and read Click Classes, Click ID and Click Element. Compare them with the value in your trigger condition.

  5. Inspect the element

    Right-click the button in your browser, choose Inspect and read its real class and attributes.

How to fix it

Add a stable tracking hook to the buttonhtml
<a href="/book" class="button--solid" data-track="hero-cta">Book a call</a>
Add the hook on your platform
  1. Edit the trigger

    Open Triggers, select the trigger, and change the condition to Click Element matches CSS selector with your new selector.

  2. Test and publish

    Run Preview, confirm the tag fires on the click, then Submit and Publish the workspace.

How stable each trigger hook is after a redesign
Trigger hookStabilityComment
Styling class (btn-primary)LowChanges with themes and design systems
Hashed class (css-1x9fk2)Very lowCan change on every build
Click TextLowBreaks on copy edits
Element IDMediumStable if developers keep it
data-track attributeHighExists only for tracking

How to confirm it's fixed

Confirmation checklist
  • In GTM Preview the tag shows as Fired on the click.
  • The trigger condition shows as met in the Tag Assistant variables view.
  • The hit appears in your browser's Network tab or in GA4 DebugView.
  • The conversion shows up in GA4 Realtime or the Google Ads and Meta test tools.
  • You have published the GTM workspace, not only tested it in Preview.
  • You tested on the live domain, on desktop and mobile layouts.

How to prevent it happening again

Prevention checklist
  • Use data attributes or IDs in triggers, never styling classes.
  • Keep a short list of tracked elements and their selectors.
  • Ask designers and developers to keep data-track attributes when rebuilding templates.
  • Run GTM Preview on staging before every redesign launches.
  • Check conversion counts the day after any theme or layout release.
  • Use automated monitoring that runs the real journey on a schedule.

How FunnelGuard handles this

See the cause and effect

Trigger tied to a renamed classInteractive
Button class renamed in redesign

Class renamed

Leads or data lost

The trigger finds no match, the tag never fires and no conversion is recorded.

Toggle to see how the same redesign affects tracking depending on the trigger hook.

Questions people ask

Why did my GTM trigger stop working after a redesign?

The most common reason is that the trigger matches a CSS class, ID or element structure that the redesign changed. The button works but no longer matches the trigger condition, so the tag does not fire. Compare Click Classes in GTM Preview with the new button's real class.

How do I fix a Google Tag Manager click trigger that is not firing?

Open GTM Preview, click the element and read the Click Classes, Click ID and Click Element variables. Update the trigger condition to match the new value, or better, add a data attribute and use a CSS selector like [data-track="cta"]. Test in Preview and publish.

What is a better trigger than a CSS class in GTM?

A data attribute added only for tracking, such as data-track, is the most stable choice. An element ID is the next best option. Styling classes and button text are the most likely to change during design or copy edits.

How do I find the new CSS class of a button?

Right-click the button in your browser, choose Inspect and read the class attribute in the highlighted HTML. You can also see it in GTM Preview under Variables as Click Classes after you click the element.

How can I tell if a redesign broke my conversion tracking?

Compare conversion counts before and after the launch with the real number of leads or orders. If recorded conversions fall while real ones do not, test your triggers in GTM Preview. Scheduled monitoring that runs the journey can also flag a missing tracking hit.

Does GTM warn me when a trigger no longer matches anything?

No. GTM does not show an error when a trigger condition stops matching. The tag simply never fires, which is why the problem can go unnoticed for weeks.

Can FunnelGuard detect a trigger broken by a class change?

Yes. FunnelGuard runs your real journey on a schedule and checks that the tracking hit is sent. When the hit is missing it alerts you with a screenshot and a likely cause, using a hash of the page structure to point to changed markup.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: missing hit; root-cause DOM hash.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.