Skip to content

Latest commit

 

History

History
46 lines (38 loc) · 894 Bytes

README.md

File metadata and controls

46 lines (38 loc) · 894 Bytes

jquery-tagmanager

Google Tagmanager jQuery plugin

Usage

$.tagManager({id: 'GTM-ABC123'});

The first call must include the GTM ID.

It will push events from every element with predefined data attributes. i.e.:

<button type="button" class="ga-tag" 
  data-gacategory="Conversion" data-gaaction="Recharge" 
  data-galabel="Recharge_Btn" data-gaevent="eventga">
</button>

The Element needs to contain "ga-tag" class.

You can also push events manually:

$.tagManager('push', {
  category: 'Conversion', 
  action: 'Recharge', 
  label: 'Recharge_Btn', 
  event: 'eventga'
});

Settings:

Default settings are:

var defaultSettings = { 
  where: "document",
  class: "ga-tag",
  event: "click",
  debug: false
};

You can change them in every call. i.e.:

$.tagManager({debug: false, class: "my-ga-tag"});