Geolocation

Learn how to define an audience based on the geolocation.

The location variable provides geographic information about the user, such as the continent, country, region, state, city, and time zone.

The least granular level is the continent, which you can use in a condition like this:

location's continent is "na"
Try in Playground

You can find the list of possible values in the Continent section. For countries, you can use the two-letter ISO code, such as us for the United States, gb for the United Kingdom, and so on.

location's country is "us"
Try in Playground

You can also use the region's code or name to create an audience of users from a specific state or region. Note that the terms state and region are interchangeable in the examples below, so you can use either stateCode or regionCode.

Croct's mascot neutral
Why two variables for the same thing?

This is merely a convenience to accommodate the fact that some countries use regions instead of states to denote administrative divisions.

Example using the state's code:

location's stateCode is "ca"
Try in Playground

Alternatively, you can use the state's name:

location's state is "California"
Try in Playground

You can also create an audience of users from a specific city:

location's city is "San Francisco"
Try in Playground

For more information on location variables, see the Location section.