<html>
<head>
<!-- Page styling here -->
<link rel='stylesheet' type='text/css' href='./style/style.css'>
<!--Countly script-->
<script type='text/javascript' src='../lib/countly.js'></script>
<script type='text/javascript'>
//initializing countly with params
const COUNTLY_SERVER_KEY = "https://your.server.ly";
const COUNTLY_APP_KEY = "YOUR_APP_KEY";
if (COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.server.ly") {
console.warn("Please do not use default set of app key and server url")
}
// initializing countly with params
Countly.init({
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
})
//track sessions automatically
Countly.track_sessions();
//track pageviews automatically
Countly.track_pageview();
Countly.track_errors();
//content filter example
function filter(params) {
var shouldContentBeShown = true;
console.log("Content filter called with params:", params);
// Add your content filtering logic here and determine whether to show content
return shouldContentBeShown;
}
//enter content zone with filter
Countly.content.enterContentZone(filter);
document.getElementById("testButton").addEventListener("click", function () {
Countly.add_event({
key: "buttonClick",
"segmentation": {
"id": "id"
}
});
});
document.getElementById("uploadBtn").addEventListener("click", function () {
var fileInput = document.getElementById("profilePicInput");
var file = fileInput.files[0];
if (!file) {
alert("Please select an image file.");
return;
}
Countly.uploadUserProfilePicture(file);
});
</script>
</head>
<body>
<!-- Header, banner etc. Top part of your site -->
<div id="header">
<h1>Sync 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">
<br /><br />
<input type="file" id="profilePicInput" accept="image/*">
<br /><br />
<input type="button" id="uploadBtn" value="Upload Profile Picture">
<p><a href='https://countly.com/'>Countly</a></p>
</center>
</body>
</html>
|