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: minification and tabbings (#475)
[Web] Add warnings to all SDK example apps that would check if propper credentials have been set or it still has the defaults. (#473)

* feat: add warning for defaults

* Delete screenlog.0

* feat: warn

* Update index.html

* Update index.js

* Update example_ga_adapter.html

* Update example_async.html

* Update example_apm_async.html
Date: 5 months ago
Size: 1,745 bytes
 

Contents

Class file image Download
<html> <head> <!-- Page styling here --> <link rel='stylesheet' type='text/css' href='./style/style.css'> <!--Countly script--> <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 = "https://your.server.ly"; //your server goes here if (Countly.app_key === "YOUR_APP_KEY" || Countly.url === "https://your.server.ly") { console.warn("Please do not use default set of app key and server url") } 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); })(); //send event on button click function clickEvent() { Countly.q.push(['add_event', { key: "buttonClick", "segmentation": { "id": "id" } }]); } </script> </head> <body> <!-- Header, banner etc. Top part of your site --> <div id="header"> <h1>Async Countly Implementation</h1> <img id="logo" src="./images/logo.png"> </div> <center> <img src="./images/team_countly.jpg" id="wallpaper" /> <br /> <input type="button" id="testButton" onclick="clickEvent()" value="Test Button"> <p><a href='https://countly.com/'>Countly</a></p> </center> </body> </html>