File: examples/example_async.html

Recommend this page to a friend!
  Classes of Arturs Sosins   Countly Web SDK   examples/example_async.html   Download  
File: examples/example_async.html
Role: Documentation
Content type: text/plain
Description: Documentation
Class: Countly Web SDK
Track site accesses and errors the Countly API
Author: By
Last change: Update of examples/example_async.html
Date: 1 year ago
Size: 1,227 bytes


Class file image Download
<html> <head> <script type='text/javascript'> //some default pre init var Countly = Countly || {}; Countly.q = Countly.q || []; //provide countly initialization parameters Countly.app_key = "YOUR_APP_KEY"; Countly.url = ""; //your server goes here Countly.debug = true; //start pushing function calls to queue //track sessions automatically Countly.q.push(['track_sessions']); //track sessions automatically Countly.q.push(['track_pageview']); //load countly script asynchronously (function() { var cly = document.createElement('script'); cly.type = 'text/javascript'; cly.async = true; //enter url of script here cly.src = '../lib/countly.js'; cly.onload = function(){Countly.init()}; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(cly, s); })(); </script> </head> <body> <script type='text/javascript'> //send event on button click function clickEvent(ob){ Countly.q.push(['add_event',{ key:"buttonClick", "segmentation": { "id": } }]); } </script> <input type="button" id="testButton" onclick="clickEvent(this)" value="Test Button"> <p><a href=''></a></p> </body> </html>