Setting up location tracking

Geolocation services are not enabled by default because not all Matrix instances have the required services configured.

If you need to find out the user’s country they are visiting from, there are two approaches you can use.

Using Edge and GeoIP

The recommended way to get a user’s location is to use a combination of Edge Side Includes (ESI) and the NGINX GeoIP module.

To test if you have ESI and GeoIP configured:

  1. Load any page of your personalisation framework enabled website.

    You can do this from within Matrix on any site asset. Right-click and select Preview  In new window
  2. Open the Developer Tools in your web browser.

  3. In the console, enter and press Enter.

  4. Review the result:

    • If you see your country returned (for example, "australia"), you can proceed with setting up tracking rules in the personalisation settings page in Edit+.

    • If you see "<esi:vars>$(GEOIP_COUNTRY_NAME)</esi:vars>" returned contact Squiz Support to get the required modules installed.

Using Mapbox

Mapbox is a service that offers mapping and location detection services. You can sign-up for an account for free with a request limit per month, which can be useful when evaluating whether Mapbox can meet your needs.

How to use Mapbox in personalisation settings:

  1. Read the access token scopes documentation on Mapbox to decide what token scopes fit your tracking requirements.

  2. Sign up for Mapbox at and complete the account verification steps.

  3. On the screen, click Create a token.

  4. On the create an access token screen leave all public scopes selected.

  5. On the portal, copy the token string you just created.

  6. In Matrix, navigate to the Paint Layout for the Personalisation Settings content container template (CCT).

  7. Locate the object property.

  8. Paste the token as the value of the mapToken property.

  9. In the property, remove the <esi:vars>$(GEOIP_COUNTRY_NAME)</esi:vars> value.

    Do not have both the and defined. If both properties are specified, geolocation with Mapbox will not work.
  10. Save the content container template to apply the settings.

© 2015- Squiz Pty Ltd