ndelitski / analytics.js-loader

Asynchronously load segment.com analytics.js with an npm module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

analytics.js-loader

This is the segment.com snippet Slightly modified to be a commonJS compatible module.

It's usable with module loaders like browserify or webpack.

Install

npm install analytics.js-loader --save

Usage

var analytics = require('analytics.js-loader')({
  writeKey: 'YOUR_WRITE_KEY',
  // you can skip the first analytics.page() call if needed, #1
  skipPageCall: false
});

analytics.identify('1e810c197e', {
  name: 'Bill Lumbergh',
  email: 'bill@initech.com'
});

analytics.track('Signed Up', {
  plan: 'Startup',
  source: 'Analytics Academy'
});

About

Asynchronously load segment.com analytics.js with an npm module

License:ISC License


Languages

Language:JavaScript 100.0%