Reputation: 149
I have a gallery of products that each belong to a specific brand. In order to track down how many impressions/reach the brands generate I was thinking about using GTM, having a trigger on DOM load or pageview, and have it read a specific class "brandlink" for the text inside this element. This way if the page loads products from Amazon, eBay and Walmart, each pageview would trigger multiple events, one for each brand, with the label = their_brand_name.
In a very similar fashion as to how ads are tracking the number of impressions they generate.
I can clearly see the "Click classes" variable, but not something that reads the text inside a class, without a click being necessary.
Pointers? Different approach? Thank you!
Upvotes: 1
Views: 9480
Reputation: 11
It's nice to use DOM variable if you want to select click element by special css-selector, just write {{variable}} instead this selector in css-match input field
Upvotes: 0
Reputation: 8907
One method would be to create a trigger that uses the DOM Element
variable type.
You can see how the Variable configuration uses the element ID (alternatively, you could use CSS selector method). And then in the Trigger configuration, you can it to fire on DOM ready if that particular DOM element exists and has a certain value (if you have more than one value, you could use a regex matching pattern).
Upvotes: 3