Skip to content

Instantly share code, notes, and snippets.

@gaarf
Last active August 29, 2015 14:05
Show Gist options
  • Save gaarf/c560769f163b0f823495 to your computer and use it in GitHub Desktop.
Save gaarf/c560769f163b0f823495 to your computer and use it in GitHub Desktop.
CDAPTracker proposed signature
// node.js mode:
var CDAPTracker = require('cask-cdaptracker');
var tracker = new CDAPTracker({
endpoint: 'https://somehost.domain.tld/path/foo/bar'
});
tracker.track({hello: 'world'}) // it returns a promise
.then(function (response) {
console.log('the world was tracked!', response)
});
//----------------------------------------------
// browser mode:
(function(CDAPTracker) {
var tracker = new CDAPTracker({
endpoint: 'https://somehost.domain.tld/path/foo/bar'
});
document.getElementById("#somebutton").addEventListener('click', function() {
tracker.track({foo: 'bar', desc: 'somebutton was clicked'});
});
})(window.CDAPTracker);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment