<html>
<head>
<input type="button" id="testButton" onclick="clickEvent()" 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,
offline_mode: true
})
//track sessions automatically
Countly.track_sessions();
//track pageviews automatically
Countly.track_pageview();
Countly.track_errors();
</script>
</head>
<body>
<script type='text/javascript' >
//send event on button click
function clickEvent(){
Countly.add_event({
key: "buttonClick",
"segmentation": {
"id": "id"
}
});
}
</script>
</body>
</html>
|