About the tag managers' condition for SEO track

Tonelb_business

Junior Member
Jr. VIP
Joined
Nov 23, 2023
Messages
121
Reaction score
22
Hello,
I want to know one thing especially from those who are very experienced in this matter. The matter is - Suppose when a person runs Google Ads and sets up conversion tracking in the web analytics sector, when tracking any elements in Tag Manager, what kind of conditions can be set as triggers, such as: I want to track button clicks?
Please look at the image below carefully. And give a logical solution as an expert.
 

Attachments

  • Tag manager condition understanding.png
    Tag manager condition understanding.png
    50.5 KB · Views: 38
Hello, Is there anyone who can give me the right answer and solution to this? I have just started this. I really need this information.
 
Use "contains" instead of "equals" for the Click Classes condition, Elementor adds dynamic classes that can vary. That way it catches the button regardless of minor class variations.
 
Try using "Contains" or "Matches CSS Selector."

Using "Equals." If you are tracking a button, you might be tempted to set the condition to: Click Classes -> Equals -> btn-submit.

The problem? If your website theme updates, or even if a user just hovers over the button, the website code often adds extra spaces or words (like btn-submit active or btn-submit hover). If you selected "Equals", Tag Manager will see the new word, the condition will fail, and your Google Ads will miss the conversion!

The Expert Logic:

Stick to "Contains": If you use Click Classes -> Contains -> btn-submit (or Click Text -> Contains -> Buy Now), your tracking stays 100% safe even if extra code or text gets added dynamically.

Matches CSS Selector: If you are experienced, this is the most bulletproof way to track buttons because it isolates the exact element on the page.

Short answer: Stay away from "Equals" unless you are 100% sure the variable will never change. Stick to "Contains" to keep your conversion tracking safe from missing data!
 
Try using "Contains" or "Matches CSS Selector."

Using "Equals." If you are tracking a button, you might be tempted to set the condition to: Click Classes -> Equals -> btn-submit.

The problem? If your website theme updates, or even if a user just hovers over the button, the website code often adds extra spaces or words (like btn-submit active or btn-submit hover). If you selected "Equals", Tag Manager will see the new word, the condition will fail, and your Google Ads will miss the conversion!

The Expert Logic:

Stick to "Contains": If you use Click Classes -> Contains -> btn-submit (or Click Text -> Contains -> Buy Now), your tracking stays 100% safe even if extra code or text gets added dynamically.

Matches CSS Selector: If you are experienced, this is the most bulletproof way to track buttons because it isolates the exact element on the page.

Short answer: Stay away from "Equals" unless you are 100% sure the variable will never change. Stick to "Contains" to keep your conversion tracking safe from missing data!

Brother, the problem is that the theme is not updated, that is, it is an Astra theme. Although it is premium. I have followed all the points exactly as you said, but it does not fire. So is this happening because the theme is not updated?
 
Use "contains" instead of "equals" for the Click Classes condition, Elementor adds dynamic classes that can vary. That way it catches the button regardless of minor class variations.
Oh, okay, brother, but I have a question
Use "contains" instead of "equals" for the Click Classes condition, Elementor adds dynamic classes that can vary. That way it catches the button regardless of minor class variations.

Brother, I tried this too. But it is not firing. And the website is basically made with a theme. So is this the problem? I'm waiting for your answer
 
Oh, okay, brother, but I have a question


Brother, I tried this too. But it is not firing. And the website is basically made with a theme. So is this the problem? I'm waiting for your answer
Enable preview mode in GTM and click the button, check exactly what value is showing in Click Classes. Use that exact string with "contains" and it will fire.
 
Brother, the problem is that the theme is not updated, that is, it is an Astra theme. Although it is premium. I have followed all the points exactly as you said, but it does not fire. So is this happening because the theme is not updated?


OK, but I do not think the issue is outdated Astra theme, even an old version of Astra should work perfectly with Google Tag Manager.

Since you have tried 'Contains' rule and it still won't fire, you are likely facing one of these 3 common WordPress/GTM roadblocks. Check these right now:

1. You maybe forgot to enable the 'Click Variables' (Most Common Basic Mistake).

2. The 'Nested Span' Problem in Astra.
Astra buttons are usually not just one single piece of code. They have text inside the button (usually wrapped in a <span> tag). When you click the button on the live site, you are actually clicking the text inside it, not the main button class.

Instead of 'Click Classes', change your variable to Click Text -> Contains -> [Type your exact button text here]. This bypasses the CSS class completely.

3. Your Cache maybe Blocking the GTM Update.
Whenever you update GTM tags on WordPress, you have to clear your cache. If you are running LiteSpeed Cache, WP Rocket, or have Cloudflare proxy active, your live site might still be loading the old version of your GTM container. Purge your cache completely, hit 'Submit' in GTM, and then use the GTM 'Preview' mode again.

I hope it helps.
 
Back
Top