Event Tracking Google Tag Manager

2

I created the event in Google tag manager, and I need to bring the value in the clicked ID. But in Analytics it shows as 'undefined', does anyone have any tips?

$('a#HomeB02').on('click', function() {

  var Id_ = $(this).attr('id');

  dataLayer.push({
      'event': 'HomeB',
      'gaEventCategory': 'Home',
      'gaEventAction': 'Banner',
      'gaEventLabel': Id_

  });
});
    
asked by anonymous 12.06.2015 / 22:37

1 answer

1

The tag manager by default does not recognize Jquery selector, a practical solution is to place the default snippet code as custom HTML and put the code below as custom and be sure to have Jquery code on the page.

$('a#HomeB02').on('click', function() {

      var Id_ = $(this).attr('id');

      ga.push('send','event','Home','Banner', ''+Id_+'');

    });

A second solution is to use the Javascript event listener or the tag manager itself.

    
16.02.2016 / 00:52