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: 5 months ago
Size: 1,227 bytes


Class file image Download
<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
//track sessions automatically

//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 type='text/javascript'>
//send event on button click
function clickEvent(ob){
		"segmentation": {
<input type="button" id="testButton" onclick="clickEvent(this)" value="Test Button">
<p><a href=''></a></p>