Website Integration
How to integrate WebSDK in Website?
Process of integrating WebSDK in Website is very similar to google analytics integration.
Copy paste the script at the bottom inside body tag.
1
<script>
2
const nector = {
3
style: {
4
btn: {
5
desktop: {}, // support props: top, bottom, left, right
6
mobile: {} // support props: top, bottom, left, right
7
},
8
popup: {
9
desktop: {} // support props: top, bottom, left, right
10
}
11
}
12
};
13
14
nector.api_key = "api_key"; // paste your api key here
15
nector.business_customer_id = localStorage.getItem("customer_id") // this should be dynamic, based on where you are saving customer_id, pass the value of customer id
16
17
// sample styles
18
19
// nector.style.btn.desktop.bottom = "28px";
20
// nector.style.btn.desktop.left = "28px";
21
22
// nector.style.btn.mobile.bottom = "50px";
23
// nector.style.btn.mobile.left = "50px";
24
25
// nector.style.popup.desktop.bottom = "155px";
26
// nector.style.popup.desktop.left = "30px";
27
28
// renders the widgets
29
const randomString = "wSVNjD";
30
let elementId = `nector-rewards-widget-${randomString}`;
31
let rootElement = document.getElementById(elementId);
32
33
if (!rootElement) {
34
let newNectorElement = document.createElement("div");
35
newNectorElement.id = elementId;
36
document.body.appendChild(newNectorElement);
37
newNectorElement.style.zIndex = 100;
38
} else {
39
rootElement.style.zIndex = 100;
40
}
41
</script>
42
<script src="https://cdn.nector.io/nector-websdk-widget/main.min.js"></script>
43
Copied!
Upon successful integration a widget will be rendered at the bottom-left of the screen. Widget popup is your user's rewarding user.
Copy link