Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web] Add warnings to all SDK example apps that would check if propper credentials have been set or it still has the defaults. #473

Merged
merged 9 commits into from
Jan 29, 2024
11 changes: 9 additions & 2 deletions examples/Angular/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ import Countly from 'countly-sdk-web';

window.Countly = Countly;

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: "YOUR_APP_KEY",
url: "https://your.domain.countly",
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
});
Countly.track_sessions();
Expand Down
11 changes: 9 additions & 2 deletions examples/Symbolication/src/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import Countly from "countly-sdk-web";

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: "YOUR_APP_KEY",
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
app_version: "1.0",
url: "https://your.domain.countly",
debug: true
});

Expand Down
10 changes: 8 additions & 2 deletions examples/example_apm.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
<script type='text/javascript' src="../plugin/boomerang/boomerang.min.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: "YOUR_APP_KEY",
url: "https://your.domain.countly", //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
})

Expand Down
9 changes: 7 additions & 2 deletions examples/example_apm_async.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@

//provide countly initialization parameters
Countly.app_key = "YOUR_APP_KEY";
Countly.url = "https://your.domain.countly"; //your server goes here
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;
Countly.loadAPMScriptsAsync = true;
// Countly.customSourceBoomerang = "../somewhere/boomerang.min.js";
Expand Down Expand Up @@ -65,4 +70,4 @@ <h1>Async Countly Implementation</h1>
</center>
</body>

</html>
</html>
8 changes: 6 additions & 2 deletions examples/example_async.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

//provide countly initialization parameters
Countly.app_key = "YOUR_APP_KEY";
Countly.url = "https://your.domain.countly"; //your server goes here
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
Expand Down Expand Up @@ -58,4 +62,4 @@ <h1>Async Countly Implementation</h1>
</center>
</body>

</html>
</html>
12 changes: 9 additions & 3 deletions examples/example_fb.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@
<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: "YOUR_APP_KEY",
url: "https://your.domain.countly", //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
});
Countly.begin_session();
Expand Down
14 changes: 10 additions & 4 deletions examples/example_formdata.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@
<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://your.domain.countly", //your server goes here
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();
Expand Down
8 changes: 6 additions & 2 deletions examples/example_ga_adapter.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
Countly.onload = Countly.onload || [];
//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;
Countly.url = "https://your.domain.countly"; //your server goes here
window.cly_ga_test_mode = true;
Countly.test_logs = [];
//start pushing function calls to queue
Expand Down Expand Up @@ -187,4 +191,4 @@ <h1>Google Analytics Adaptor</h1>
</center>
</body>

</html>
</html>
11 changes: 9 additions & 2 deletions examples/example_gdpr.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
<script type='text/javascript'>

//initializing countly with params and passing require_consent config as true
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: "YOUR_APP_KEY",
url: "https://your.domain.countly", //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true,
require_consent: true //this true means consent is required
});
Expand Down
11 changes: 9 additions & 2 deletions examples/example_helpers.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
<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: "YOUR_APP_KEY",
url: "https://your.domain.countly", //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
});

Expand Down
40 changes: 29 additions & 11 deletions examples/example_multiple_instances.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@
Countly = Countly || {};
Countly.q = Countly.q || [];



//initializing first instance, which will be global Countly
Countly.init({
app_key: "YOUR_APP_KEY1",
url: "https://your.domain.countly", //your server goes here
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
})
//report event to first app
Expand All @@ -27,26 +32,39 @@


//initialize second instance for another app synchronously
var Countly2 = Countly.init({
app_key: "YOUR_APP_KEY2", //must have different APP key
url: "https://your.domain.countly", //your server goes here
const COUNTLY_SERVER_KEY2 = "https://your.server.ly";
const COUNTLY_APP_KEY2 = "YOUR_APP_KEY2";

if(COUNTLY_APP_KEY2 === "YOUR_APP_KEY2" || COUNTLY_SERVER_KEY2 === "https://your.server.ly"){
console.warn("Please do not use default set of app key and server url")
}
// initializing countly with params
var Countly2 = Countly.init({
app_key: COUNTLY_APP_KEY2,
url: COUNTLY_SERVER_KEY2, //your server goes here
debug: true
});

//report event to second app
Countly2.add_event({
key: "second_app"
});

const COUNTLY_SERVER_KEY3 = "https://your.server.ly";
const COUNTLY_APP_KEY3 = "YOUR_APP_KEY3";

if(COUNTLY_APP_KEY3 === "YOUR_APP_KEY3" || COUNTLY_SERVER_KEY2 === "https://your.server.ly"){
console.warn("Please do not use default set of app key and server url")
}

//initialize third instance for another app asynchronously
Countly.q.push(["init", {
app_key: "YOUR_APP_KEY3", //must have different APP key
url: "https://your.domain.countly", //your server goes here
app_key: COUNTLY_APP_KEY3, //must have different APP key
url: COUNTLY_SERVER_KEY3, //your server goes here
debug: true
}])
//report event to third app asynchronously by passing app key as first arg
Countly.q.push(["YOUR_APP_KEY3", "add_event", {
Countly.q.push([COUNTLY_APP_KEY3, "add_event", {
key: "third_app"
}]);
</script>
Expand Down
11 changes: 9 additions & 2 deletions examples/example_opt_out.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
<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: "YOUR_APP_KEY",
url: "https://your.domain.countly", //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
})
//track sessions automatically
Expand Down
11 changes: 9 additions & 2 deletions examples/example_rating_widgets.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
<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: 'YOUR_APP_KEY', //your app key
url: 'https://your.domain.countly', //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
});
//=====================================================================================================
Expand Down
11 changes: 9 additions & 2 deletions examples/example_remote_config.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
<script type='text/javascript'>

//initializing countly with params and remote config
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: "YOUR_APP_KEY",
url: "https://your.domain.countly", //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true,
rc_automatic_optin_for_ab: true, // set it to false for not opting in users for AB testing while fetching the remote config (only with latest API)
use_explicit_rc_api: false, // set it to true to use the latest API
Expand Down
11 changes: 9 additions & 2 deletions examples/example_sync.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
<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: "YOUR_APP_KEY",
url: "https://your.domain.countly", //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
})
//track sessions automatically
Expand Down
11 changes: 9 additions & 2 deletions examples/examples_feedback_widgets.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
<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: 'YOUR_APP_KEY', //your app key
url: 'https://your.domain.countly', //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
});

Expand Down
10 changes: 7 additions & 3 deletions examples/mpa/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
var Countly = Countly || {};
Countly.q = Countly.q || [];
// Countly Config
Countly.app_key = 'YOUR_APP_KEY';
Countly.url = 'https://your.domain.countly';
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.session_update = 30; //Time interval for session extend
Countly.use_session_cookie = false; //if false, begin_session on every app open, be it in new tab
Countly.debug = true;
Expand Down Expand Up @@ -409,4 +413,4 @@ <h3>Change device ID:</h3>
document.getElementById("form-div").style.display = "block";
});
</script>
</body>
</body>
Loading
Loading