countly-sdk-web-cip
Version:
Countly Web SDK
51 lines (47 loc) • 1.18 kB
HTML
<!--
Example on collecting user information from FaceBook
-->
<html>
<head>
<!--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
});
Countly.begin_session();
</script>
</head>
<body>
<script src="https://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
FB.init({
appId: '251676171676751',
status: true,
cookie: true,
oauth: true
});
function CountlyGatherFBData(){
Countly.collect_from_facebook({"location":"location.name", "tz":"timezone", "somekey":"none.existing.key"});
};
FB.getLoginStatus(function(stsResp) {
if(stsResp.authResponse) {
//alert("is logged in");
CountlyGatherFBData();
} else {
FB.login(function(loginResp) {
if(loginResp.authResponse) {
//alert("authenticated");
CountlyGatherFBData();
} else {
alert('Please authorize this application to use it!');
}
});
}
});
</script>
</body>
</html>