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.
<script>
const nector = {
style: {
btn: {
desktop: {}, // support props: top, bottom, left, right
mobile: {} // support props: top, bottom, left, right
},
popup: {
desktop: {} // support props: top, bottom, left, right
}
}
};
nector.api_key = "api_key"; // paste your api key here
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
// sample styles
// nector.style.btn.desktop.bottom = "28px";
// nector.style.btn.desktop.left = "28px";
// nector.style.btn.mobile.bottom = "50px";
// nector.style.btn.mobile.left = "50px";
// nector.style.popup.desktop.bottom = "155px";
// nector.style.popup.desktop.left = "30px";
// renders the widgets
const randomString = "wSVNjD";
let elementId = `nector-rewards-widget-${randomString}`;
let rootElement = document.getElementById(elementId);
if (!rootElement) {
let newNectorElement = document.createElement("div");
newNectorElement.id = elementId;
document.body.appendChild(newNectorElement);
newNectorElement.style.zIndex = 100;
} else {
rootElement.style.zIndex = 100;
}
</script>
<script src="https://cdn.nector.io/nector-websdk-widget/main.min.js"></script>
Upon successful integration a widget will be rendered at the bottom-left of the screen. Widget popup is your user's rewarding user.
Last modified 1yr ago