xGeo

The XGeo add-on, gives you the ability of directly collecting user location data with all the received requests.

Description

The XGeo add-on, gives you the ability of directly collecting user location data with all the received requests.

This add-on works by performing a lookup with the IP address of the user.

It won't provide you with the home address of your website visitors, but it will give you a valuable insight.


Once you enable this addon, all the requests coming from your website will contain the following X-Headers with the corresponding accuracy levels:

  • X-GEO-Country (iso code) : 99% acc
  • X-GEO-Region (iso code) : 80-90% acc
  • X-GEO-City (city name): 50-70% acc

And an additional header containing the IP address:

  • X-GEO-Ipaddress

Implementation

You can start making use of xGeo addon in three simple steps:


1. Activate the add-on on sprtags.io Containers -> Add-ons -> xGeo and click on save:


xGeo screenshot

2. Test the setup by sending a request to the server side container:


This can be done by just opening your web container on preview mode, or by using curl.

To use curl: Click on the three dots at the top right of the screen:


xGeo screenshot
Click on send requests manually, copy the command and execute it:

xGeo screenshot

To execute the command follow the instructions below, paste it, and press enter (↵.):


Windows:

Open Command Prompt or PowerShell on your Windows machine. You can find Command Prompt in the Start menu, or use the Windows key + R to open the Run dialog box and type cmd.


Mac:

Open Terminal by using the Spotlight search or by pressing Command (⌘) + Option + T on your keyboard.


If we inspect the incoming HTTP request, we should be able to see the X GEO headers with the location information.


With xGeo disabled:

xGeo screenshot


With xGeo enabled:

You can see that the location was detected successfully and that the new headers are available.


xGeo screenshot


3. Use the provided header names to create the corresponding header variables inside the server side container:


- Click on Variables.

- In User-Defined Variables click on new.

- Select Request Header as variable type.

- Enter the header name in the name field.

- Give the Variable a name and click save.


xGeo screenshot


If we reopen the preview mode and repeat the tests, the variables with the header values will be showing:


xGeo screenshot

Now, you are ready to start sending the location data with your tags.