I have a custom JS event that fires when accordion panel is opened. I would like to track the opening as Google Analytics event with panel id as the event label.
Using the old non-GTM approach I would do it like this:
$('#my-accordion').on('down.zf.accordion', function(e, panel) {
ga('send', 'event', 'accordion', 'open', panel.attr('id'));
});
But I would like to do this with Google Tag Manager and with as less changes in the code on page as possible.
So far I have created this in Google Tag Manager:
Trigger, type Custom Event that fires on 'down.zf.accordion'
Tag, type Universal Analytics with my tracking id, track type: Event (accordion, open, [probably a global JS variable that is set to panel.attr('id')?])
But the tag won't even fire when testing in the GTM preview. What am I doing wrong?