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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://globalreactioncompany.gitbook.io/pointng/pointng-widget.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
