How to show someone's current City, Country or Location

Hi there,

For this, we generated an API Key using API Key - ipdata

Next, go to Custom Codes > Custom JS (Body) and add the following:

    function json(url) {
         return fetch(url).then(res => res.json()); 
        let apiKey = '35b57d04281f02df752982fac4d9c05e4f56f37eaef50ccffd597fe7'; 
        json(`${apiKey}`).then(data => { 
             document.querySelector(".city_name .paragraph-inner *").innerHTML =;

Finally, Select any paragraph element, go to Advanced, and add city_name as a Class Name. The City name will be displayed on the preview instead of the dummy text.

PS: Other info can be extracted from the object data such as the country.

Let us know how it goes.

1 Like