Created
November 30, 2013 20:34
-
-
Save dustinlarimer/7724118 to your computer and use it in GitHub Desktop.
Keen.io page view drop-in
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
// Copy-paste from https://keen.io/docs/clients/javascript/usage-guide/#js-install-guide | |
var Keen=Keen ||{configure:function(e){this._cf=e},addEvent:function(e,t,n,i){this._eq=this._eq||[],this._eq.push([e,t,n,i])},setGlobalProperties:function(e){this._gp=e},onChartsReady:function(e){this._ocrq=this._ocrq||[],this._ocrq.push(e)}};(function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=("https:"==document.location.protocol?"https://":"http://")+"dc8na2hxrj29i.cloudfront.net/code/keen-2.1.0-min.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})(); | |
// readKey is not required for this example | |
Keen.configure({ | |
projectId: "your_project_id", | |
writeKey: "your_write_key", | |
readKey: "your_read_key" | |
}); | |
// Attach your own properties when logging events | |
Keen.addEvent('pageView', { | |
page: window.location.href, | |
time: new Date().toISOString(), | |
referrer: document.referrer, | |
agent: window.navigator.userAgent | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment