countly-sdk-web-cip
Version:
Countly Web SDK
35 lines (33 loc) • 752 B
HTML
<html>
<head>
<input type="button" id="testButton" onclick="clickEvent(this)" value="Test Button">
<p><a href='http://count.ly/'>Count.ly</a></p>
<!--Countly script-->
<script type='text/javascript' src='../lib/countly.js'></script>
<script type='text/javascript'>
//initializing countly with params
Countly.init({
app_key: "YOUR_APP_KEY",
url: "https://try.count.ly", //your server goes here
debug:true
})
//track sessions automatically
Countly.track_sessions();
//track pageviews automatically
Countly.track_pageview();
</script>
</head>
<body>
<script type='text/javascript'>
//send event on button click
function clickEvent(ob){
Countly.add_event({
key:"buttonClick",
"segmentation": {
"id": ob.id
}
});
}
</script>
</body>
</html>