Button clicks tracking using CSS Selector
I'm trying to track a Button click using CSS selector
Event is getting fired but in that I cannot able to see eVars and events.
1. I added the CSS script in events --> Core--> clicks.
(CSS Script)
button.productcollection__item-button.productcollection__item-button--add-to-wish-list
2. Added the set variables custom code
(Custom Code)
document.addEventListener('click', function(event) {
if (event.target.matches('button.productcollection__item-button.productcollection__item-button--add-to-wish-list')) {
var buttonText = event.target.innerText;
s.eVar49 = buttonText;
s.linkTrackVars = 'eVar49,events';
s.linkTrackEvents = 'event19';
s.events = 'event19';
s.tl(this, 'o', 'Button Click');
}
});