Skip to content

A wrapper and configuration tool to seamlessly handle multiple Google Analytics accounts, complete with custom metrics and dimensions.

License

Notifications You must be signed in to change notification settings

joshbeckman/gauntlet.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gauntlet.js

A wrapper and configuration tool to seamlessly handle multiple Google Analytics accounts.

It's small enough (~2kb) to use without worry. It can even be used just for a single GA account at a time to simply clean and modularize your code.

Is it any good?

You bet.

Installation

bower install gauntletjs

Usage

It's as easy as adding one javascript file to your document, and defining the Google Analytics profiles to which you will send data.

<script type="text/javascript" 
  src="/gauntlet.min.js">
</script>
<script type="text/javascript">
  if (Gauntlet) {
    // Let's list out our accounts
    var myGauntlet = new Gauntlet({
      accounts:[
        {
          profile: 'UA-XXXXX-XX',
          domain: 'auto',
          name: 'ProductAccount'
        },
        {
          profile: 'UA-XXXXX-XX',
          domain: 'example.com',
          name: 'BrandAccount'
        }
      ],
      custom: {
        'dimension1': 'custom dimension data',
        'metric2': 'custom metric data'
      },
      displayFeatures: true
    });
  }
</script>

Alternatively, you can download the Gauntlet source and bundle/minify it into your own source code. It plays nicely with your other source files.

Author

Joshua Beckman

License

Licensed under MIT.

About

A wrapper and configuration tool to seamlessly handle multiple Google Analytics accounts, complete with custom metrics and dimensions.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published