Skip to content

Instantly share code, notes, and snippets.

@scien
Created March 10, 2014 00:41
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 scien/9457480 to your computer and use it in GitHub Desktop.
Save scien/9457480 to your computer and use it in GitHub Desktop.
initKeenIO: (project_id, write_key) ->
window.Keen = window.Keen || {
configure: (e) ->
this._cf = e
addEvent: (e,t,n,i) ->
this._eq = this._eq || []
this._eq.push [e,t,n,i]
setGlobalProperties: (e) ->
this._gp = e
onChartsReady: (e) ->
this._ocrq = this._ocrq || []
this._ocrq.push e
}
Keen.configure {
projectId: project_id
writeKey: write_key
}
k = document.createElement 'script'
k.type = 'text/javascript'
k.async = true
url = 'dc8na2hxrj29i.cloudfront.net/code/keen-2.1.0-min.js'
k.src = "#{document.location.protocol}//#{url}"
s = document.getElementsByTagName("script")[0]
s.parentNode.insertBefore k, s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment