Skip to content

Antevenio/jquery-tagmanager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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"});

About

Google Tagmanager jQuery plugin

Resources

Stars

Watchers

Forks

Packages

No packages published