UNPKG

countly-sdk-web

Version:
71 lines (62 loc) 2.17 kB
<!-- Example on collecting user information from FaceBook --> <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'> 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 }); Countly.begin_session(); </script> </head> <body> <!-- Header, banner etc. Top part of your site --> <div id="header"> <h1>Collecting Facebook Info</h1> <img id="logo" src="./images/logo.png"> </div> <center> <img src="./images/team_countly.jpg" id="wallpaper" /> </center> <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>