Tracking snippets for Google Analytics and Piwik / Matomo
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit May 20, 2018
README.md Stupid mistake, Mat*o*mo, not Mat*a*mo May 20, 2018
index.js Initial commit May 20, 2018
package.json Stupid mistake, Mat*o*mo, not Mat*a*mo May 20, 2018

README.md

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

import { GoogleAnalytics, Matomo } from './trackings.js';

new GoogleAnalytics('UA-xxxxxx-xx'),

new Matomo({
    trackerUrl : '//mysite.com/stats/',
    siteId : 1
});

Old style ES5

<script src="trackings.js"></script>
new trackings.GoogleAnalytics('UA-xxxxxx-xx'),

new trackings.Matomo({
    trackerUrl : '//mysite.com/stats/',
    siteId : 1
});

API

GoogleAnalytics(id)

new GoogleAnalytics('UA-xxxxxx-xx'),

Matomo({ trackerUrl, siteId })

new trackings.Matomo({
    trackerUrl : '//mysite.com/stats/',
    siteId : 1
});

License

MIT © Hay Kranen