Installation

Instructions how to set up pointNG to a website.

Step 1. Installation

Install the pointNG script on every page you wish to use pointNG by pasting it before closing </body> tag.

<script src="https://cdn.pointng.io/pointng-min.js"></script> 

pointNG adds a 99kB JS bundle that includes all the features.

Please note that pointNG is in beta and is still undergoing final testing before its official release.

Step 2. Configuration

Below your tracking script, paste this code to initialize pointNG and set up your parameters

const pointng = new PointNG({ 
    level: 'country',
    api_key: "YOUR-API-KEY-HERE"
}); 

Use the 'level' parameter to choose the level you wish to identify your users' location. Options are 'continent', 'country', 'state' and 'city' To optimize speed, we recommend that you use the level that is necessary in your service.

If a user does not permit the use of GPS-data, pointNG uses the device time zone as default fallback to estimate the location.

Step 3. Obtain your API-key

To get your free API key, sign up for free here.

After signing in, add your first website. This generates the needed API keys and whitelists your domain.

Insert your public API key to 'api_key' that is displayed on pointNG web-portal after you create a website. In test environment, please use the 'TEST Public API key'.

Step 4. Drive!

Success! Now you are ready to start using pointNG secure functions. Below is an example of a minimum implementation that prompts the user for location permission and console.logs the user location result.

<script src="https://cdn.pointng.io/pointng-min.js"></script> 
<script>
    const pointng = new PointNG({ 
        level: 'continent', 
        api_key: "YOUR-API-KEY"
    });

    pointng.getLocation().then(function(prediction) {
        console.log(prediction)
        //Do your magic here!
    })
</script>

That's it! Head over to the next section to learn how pointNG functions work.

Last updated