Geolocation

Home » Support » Docs » Geolocation

Full Picture uses geolocation to show cookie notice and load scripts in certain locations.

Visitors’ location can be checked with:

  1. IP-API – free service for up to 1000 location checks a day – website.
  2. DB-API – free service for up to 1000 location checks a day – website.
  3. ipdata – requires registration here. Available plans from free (for non-commercial use) to paid. This geolocation method is available from FP v.3.4.0.
  4. Cloudflare – Free for all users (Cloudflare account is not required) – website.
  5. Cloudflare – Free for Cloudflare users – website.
  6. Cloudflare Worker – free for cloudflare users – requires extra setup.
  7. Cloudways Geo-ip – free for cloudways users – requires you to turn on Geo-IP option in your application settings – website.

How to set up geolocation with a Cloudflare Worker:

  1. Log in to Cloudflare
  2. Click “Workers”, then “Manage Workers” and after the page reloads “Create a Worker”
cloudflare workers 1
  1. In the new window:
cloudflare workers 2
  1. Replace the script on the left (1) with this:
addEventListener("fetch", event => {
  const response = new Response(`{"country":"${event.request.headers.get("cf-ipcountry")}"}`, {
    headers: {
      "Access-Control-Allow-Origin": "*",
      "Content-Type": "application/json"
    }
  })
  
  event.respondWith(response)
})
  1. Click “Send” button (2) and then “Preview” (3).
    If you did everything correctly, you will see your country code on the screen, like {"country": "GB")
  2. Now click “Save and Deploy” button and copy the URL that you will see in a popup window.
  3. Paste this URL in the geolocation settings field in Full Picture’s settings panel

And you’re done!