# Create a user location audience

## Introduction

User location can be a great way of tailoring your loyalty program to a specific user. It can be used to promote local events and rewards, while ensuring that you're only showing relevant information to relevant people.

***

## Configuration

### Users in a particular city

1. Navigate to Users > Audiences and then click 'Create' in the top right corner.
2. Give the audience a name and description. Turn on AUDIENCE\_JOINED and AUDIENCE\_LEFT events if needed. Set the refresh rate to 'Daily'.
3. Move to the criteria tab. The criteria should be;
   * Profile matches JSON schema

     ```json
     {
       "$schema": "http://json-schema.org/draft-06/schema#",
       "type": "object",
       "required": [
         "city"
       ],
       "properties": {
         "city": {
           "const": "enter city name here"
         }
       }
     }
     ```
4. Click save.

### Users in a particular UK postcode area

{% hint style="warning" %}
The following setup applies to UK postcode formats. Setting up for different countries will require a different schema. The country validation in the schema ensures that countries with similar postcode formats are excluded.
{% endhint %}

{% hint style="info" %}
The criteria is case sensitive. Consider adding upper and lowercase variations to the schema to ensure accuracy. E.g., for the NE postcode the pattern would be `"^(NE|Ne|nE|ne)\\d+"`
{% endhint %}

1. Navigate to Users > Audiences and then click 'Create' in the top right corner.
2. Give the audience a name and description. Turn on AUDIENCE\_JOINED and AUDIENCE\_LEFT events if needed. Set the refresh rate to 'Daily'.
3. Move to the criteria tab. The criteria should be;
   * Profile matches JSON schema

     ```json
     {
       "$schema": "http://json-schema.org/draft-06/schema#",
       "type": "object",
       "properties": {
         "postcode": {
           "type": "string",
           "pattern": "^(POSTCODE AREA 1|POSTCODE AREA 2|POSTCODE AREA 3)\\d+"
         },
         "country": {
           "const": "GB"
         }
       }
     }
     ```
4. Click save.

***

## Tips

* The end-user can update their location details via their profile at any time. Consider this if you're using this audience to limit reward availability.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kbase.whitelabel-loyalty.com/product/loyalty-engine/audiences/audience-tutorials/create-audiences-based-on-user-profile-information/create-a-user-location-audience.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
