> For the complete documentation index, see [llms.txt](https://globalreactioncompany.gitbook.io/pointng/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://globalreactioncompany.gitbook.io/pointng/pointng-widget.md).

# 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"](/files/-MJYRhP_Q6NEG4NWJK6A)

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