pointNG widget

Instructions how to use pointNG widget.

pointNG widget makes it possible for your users to determine when and on what level they allow you to use their location. Embed pointNG widget to your website by configuring the following parameters in pointNG initialization script.

const pointng = new PointNG({
level: 'country',
api_key: "YOUR-API-KEY-HERE",
currentWidgetPosition: 'right', //options are 'left' and 'right
privacyPolicyLink: 'YOUR-PRIVACY-POLICY-URL'
});

Then you can add pointNG widget to your website with the following function:

pointng.openWidget(pointng.start())
pointNG widget when a user has opened the popup by clicking the "P-icon"

React to your users' actions:

pointng.openWidget(pointng.start()).then(value => {
document.getElementById("locateMeWithPointNG").addEventListener("click", listenForPrediction)
})
function listenForPrediction() {
var updateContent = function() {
if (pointng.predictionData.ready == true) {
clearInterval(checkForUserLocation);
console.log(pointng.predictionData)
//do your magic with pointng.predictionData
}
}
var checkForUserLocation = setInterval(updateContent, 100)
}