I want to use the Element Visibility trigger in Matomo 3.13. The configuration Selection Method: Element ID with the corresponding ID works fine but Selection Method: CSS Selector with the corresponding CSS class doesn’t work. Only the trigger of the first config appears in the debugger.
Is this a known issue or could be anything wrong with my config?
Thank you for the solution!
Unfortunately it took me a while to find it …
Please dear Matomo Tag Manager Developers add this important piece of information to the description of the “CSS Selector” field.
So far it says:
“A CSS selector allows you to select an element by id, className, element names, etc. If multiple elements match this selector, the first matching element will be used to get the value from.”
While this seems obvious to someone who knows CSS (without it, it wouldn’t be a selector), there are probably many people using Tag Manager who are not familiar with CSS so it is worth mentioning that detail in the description.
A CSS selector allows you to select an element by id, className, element names, etc. If multiple elements match this selector, the first matching element will be used to get the value from. Examples for valid selectors are “.classname”, “#id” or “li a”.
I want to fire a tag when a div pops up based on a button click: the visible element I want to track is the div (see the divs in the screenshot below. Measuring one of them is sufficient)
My tag and trigger are as follows:
My trigger:
Type: Element Visibility
Name: Element Visibility - Uitklapmenu
Selection method: CSS Selector
CSS Selector: (tried both:) .class and div.class
Fire: Once per element
Min % Visible: 30
Visible Element Classes contains sc-3deb3e4
My tag:
Type: Matomo Analytics
Name: Click Additional information
Tracking Type: Event
Execute when: Element Visbility - Uitklapmenu
Other Element Visibility triggers are working and I have no clue what to do. Anyone any idea?