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

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

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.count.ly",
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
});
Countly.track_sessions();
Expand Down
12 changes: 10 additions & 2 deletions examples/React/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ import Countly from 'countly-sdk-web';
//Exposing Countly to the DOM as a global variable
//Usecase - Heatmaps
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: 'YOUR_SERVER_URL',
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
});

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.count.ly",
debug: true
});

Expand Down
6 changes: 5 additions & 1 deletion 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.count.ly"; //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
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='module'>
import Countly from '../Countly.js';

//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.count.ly", //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='module'>
import Countly from '../Countly.js';

//initializing countly with params
Countly.init({
app_key: "YOUR_APP_KEY",
url: "https://your.domain.count.ly", //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
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 @@
import Countly from '../Countly.js';

//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.count.ly", //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 @@
import Countly from '../Countly.js';

//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.count.ly", //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
});

Expand Down
38 changes: 29 additions & 9 deletions examples/example_multiple_instances.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@
import Countly from '../Countly.js';

//initializing first instance, which will be global Countly
Countly.init({
app_key: "YOUR_APP_KEY1",
url: "https://your.domain.count.ly", //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 @@ -23,26 +30,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.count.ly", //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.count.ly", //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 @@
import Countly from '../Countly.js';

//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.count.ly", //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='module'>
import Countly from '../Countly.js';

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.count.ly', //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 @@
import Countly from '../Countly.js';

//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.count.ly", //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true,
rc_automatic_optin_for_ab: false, // 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: true, // 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 @@
import Countly from '../Countly.js';

//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.count.ly", //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='module'>
import Countly from '../Countly.js';

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.count.ly', //your server goes here
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
debug: true
});

Expand Down
12 changes: 10 additions & 2 deletions examples/worker.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import Countly from "../Countly.js";

const STORAGE = {};

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")
}

Countly.init({
app_key: "YOUR_APP_KEY",
url: "https://your.domain.count.ly",
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY,
debug: true,
clear_stored_id: true, // Resets the stored device ID on init
storage: {
Expand Down
Loading