Skip to content

Instantly share code, notes, and snippets.

@sperand-io
Last active August 27, 2015 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sperand-io/c490a43f0f5e9b124ec2 to your computer and use it in GitHub Desktop.
Save sperand-io/c490a43f0f5e9b124ec2 to your computer and use it in GitHub Desktop.
duo index.js > build.js
/**
* Dependencies
* Note you could always reference any branch / release you like
* http://duojs.org/ :)
*/
var Lytics = require('segment-integrations/analytics.js-integration-lytics@master');
var analytics = require('segmentio/analytics.js-core@2.10.1');
/**
* Grab reference to stubbed analytics object
*/
var analyticsq = window.analytics || [];
/**
* Use the Lytics integration plugin and initialize with correct options
*/
analytics.use(Lytics);
analytics.initialize({
"Lytics": {
cid: '12',
apiKey: '',
stream: 'app'
},
}, { initialPageview: false, plan: {} });
// this is all unnecessary if you're requiring synchronously, but pairs nicely
// if you load the script with a snippet that stubs the methods like ours
while (analyticsq && analyticsq.length > 0) {
var args = analyticsq.shift();
var method = args.shift();
if (analytics[method]) analytics[method].apply(analytics, args);
}
// global :)
window.analytics = analytics;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment