1.0.5 • Published 3 years ago

@carlhopf/analyticsjs v1.0.5

Weekly downloads
1
License
MIT
Repository
bitbucket
Last release
3 years ago

mpanalytics

Simple wrapper around google analytics measurement protocol, which works both clientside (using browserify) and serverside (using nodejs xmlhttpreqest wrapper package).

For testing please provide your own property id in test/config.js

var mpanalytics = require('../index');

var tracker = mpanalytics.create({
	tid: 'UA-...',
	sampleRate: 100,
});

tracker.pageview({
	page: '/home',
}, function (err) {
	console.log(err);
});

tracker.event({
	category: 'test',
	action: 'alright',
});

CSP

Browser requests go to https://www.google-analytics.com/collect, so:

<meta http-equiv="Content-Security-Policy" content="default-src 'self' gap: http://*.google-analytics.com https://*.google-analytics.com; style-src 'self' 'unsafe-inline'; media-src *;">

Cordova plugin uses native google analytics libraries, no need to adjust CSP for them.

Chrome apps

The policy definition in your manifest.json might look like:

"content_security_policy": "script-src 'self' https://www.google-analytics.com; object-src 'self'",

Tested on

  • iOS 9.3
  • Chrome 49
1.0.5

3 years ago

1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago