trackings
Tracking snippets for Google Analytics and Piwik / Matomo
Instead of adding the Google Analytics and Matomo / Piwik snippets to all your html pages, you can just use this library to include them in your Javascript code.
Install
Using npm
:
$ npm install --save trackings
Using yarn
:
$ yarn add trackings
trackings
can be used as a CommonJS module, AMD (with Require.js) or as a plain old Javacript global.
Usage
ES6
; 'UA-xxxxxx-xx' trackerUrl : '//mysite.com/stats/' siteId : 1;
Old style ES5
'UA-xxxxxx-xx' trackerUrl : '//mysite.com/stats/' siteId : 1;
API
GoogleAnalytics(id)
'UA-xxxxxx-xx'
Matomo({ trackerUrl, siteId })
trackerUrl : '//mysite.com/stats/' siteId : 1;
License
MIT © Hay Kranen