Last active
August 27, 2015 01:35
-
-
Save sperand-io/c490a43f0f5e9b124ec2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
duo index.js > build.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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