-
-
Save bosskovic/54f554e5dc3b14850dd4 to your computer and use it in GitHub Desktop.
simple keen
This file contains hidden or 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
<html> | |
<head> | |
<script src="jquery-1.11.2.min.js"></script> | |
<script src="keen-3.2.4.js"></script> | |
<!--<script src="https://d26b395fwzu5fz.cloudfront.net/3.2.4/keen.min.js" type="text/javascript"></script>--> | |
<!--<script type="text/javascript">--> | |
<!--!function(a,b){a("Keen","https://d26b395fwzu5fz.cloudfront.net/3.1.0/keen.min.js",b)}(function(a,b,c){var d,e,f;c["_"+a]={},c[a]=function(b){c["_"+a].clients=c["_"+a].clients||{},c["_"+a].clients[b.projectId]=this,this._config=b},c[a].ready=function(b){c["_"+a].ready=c["_"+a].ready||[],c["_"+a].ready.push(b)},d=["addEvent","setGlobalProperties","trackExternalLink","on"];for(var g=0;g<d.length;g++){var h=d[g],i=function(a){return function(){return this["_"+a]=this["_"+a]||[],this["_"+a].push(arguments),this}};c[a].prototype[h]=i(h)}e=document.createElement("script"),e.async=!0,e.src=b,f=document.getElementsByTagName("script")[0],f.parentNode.insertBefore(e,f)},this);--> | |
<!--</script>--> | |
</head> | |
<body> | |
<div id="button-holder"> | |
<a href="#" id="big-red-button"><img src="big_red_button.jpg"></a> | |
</div> | |
<script type="text/javascript"> | |
$(window).on('load', function(){ | |
// ADD CREDENTIALS HERE | |
var keenClient = new Keen({ | |
projectId: "", | |
writeKey: "" | |
}); | |
$("#big-red-button").on('click', function(event) { | |
console.log('clicked'); | |
keenClient.addEvent("button-presses", { | |
size : "big", | |
color : "red" | |
}, function(err, res) { | |
console.log(err) | |
console.log(res) | |
$("#button-holder").text("THIS PAGE WILL RELOAD IN 5 SECONDS"); | |
setTimeout(function() { | |
window.location.reload(); | |
}, 5000); | |
}); | |
event.preventDefault(); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment