# Audience Targeting Conditions

Created: 10.05.2023&#x20;

Updated: 11.05.2023&#x20;

Author: Anastasia Nogovitsyna

Targeting relevant content to specific users begins with the establishment of audience targeting conditions. A well-executed audience management strategy is fundamental to ensuring the efficacy of your target efforts.&#x20;

Audiences are created based on specified conditions. These conditions can be amalgamated to create highly precise user segments.

The available audience parameters can be categorized into three primary categories:

1. **Condition:** This encompasses a set of prerequisites that a user must satisfy to be included in the audience.
2. **Attribution Window:** This defines the time period during which the specified conditions must be fulfilled.
3. **Retention Period:** This determines how long users should remain within the audience after they no longer fulfill the specified conditions.

## 1. Condition

<details>

<summary>Audience</summary>

Select audiences from a dropdown menu of all audiences generated by any user within the current section.

**Available Conditions**

* Belongs to
* Does not belong to

#### Available Values

Audiences existing in the section.

#### Example\*

<img src="/files/iiB9843qw2rSylSbtoQC" alt="" data-size="original">

\*Audiences chosen in the screenshot are not default audiences in the platform — they were manually created solely for demonstration purposes.

</details>

<details>

<summary>Browser</summary>

Selection of users with a specific browser / browsers.

In case of front-end implementation, this is determined by the script, while in API implementation, it's determined based on the value in <mark style="color:red;">`context.device.userAgent`</mark> parameter.

#### Available Conditions

* Is
* Is not

#### Available Values

* Chrome
* Firefox
* Safari
* Yandex
* Edge
* Internet Explorer
* Opera
* Android Browser
* Samsung Internet
* MIUI browser
* Other

#### Example

<img src="/files/hgwt6NAmxy7fUYVzLxdq" alt="" data-size="original">

</details>

<details>

<summary>Traffic Source </summary>

Selection of users who arrived to the site from a specific traffic source (Direct, Paid Search, Referral, Search, Social). [More about traffic sources](/lang/en/general-information/traffic-sources-identification.md).

For front-end implementation, it is determined by the script, while in API implementation, it's determined based on <mark style="color:red;">`context.page.referrer`</mark>parameter.

#### Available Conditions

* Is
* Is not

#### Available Values

* Direct
* Paid Search
* Referral
* Search
* Social

#### Example

<img src="/files/NL3KYMDPxG2ApLEr6Me2" alt="" data-size="original">

</details>

<details>

<summary>Device Category </summary>

Selection of users accessing the site from a specific type of device (desktop, tablet, smartphone).

For front-end implementation, this is determined by the script, while in API implementation, it's determined based on <mark style="color:red;">`context.device.userAgent`</mark> parameter.

#### Available Conditions

* Is
* Is not

#### Available Values

* Desktop
* Mobile
* Tablet

#### Example&#x20;

<img src="/files/l1v7xSfc9retizbkdbYF" alt="" data-size="original">

</details>

<details>

<summary>Country </summary>

Selection of users located in the chosen country.

For front-end implementation, this is determined by the script using the user's IP, while in API implementation, it's determined based on the user's IP passed in <mark style="color:red;">`context.device.ip`</mark> parameter.

#### Available Conditions

* Is
* Is not

#### Available Values

The value is taken from the reference according to the country code.

[<mark style="background-color:blue;">We use MaxMind geoIP as a reference for countries, regions, and cities.</mark>](#user-content-fn-1)[^1]

**Example**&#x20;

<img src="/files/52HtAmGIBSTs5RAYyRq1" alt="" data-size="original">

</details>

<details>

<summary>Region </summary>

Selection of users located in the chosen region.

For front-end implementation, this is determined by the script using the user's IP, while in API implementation, it's determined based on the user's IP passed in <mark style="color:red;">`context.device.ip`</mark> parameter.

#### Available Conditions

* Is
* Is not

<mark style="background-color:blue;">The chosen region does not include the regional center</mark>

#### Available Values

The value is taken from the reference according to the region code.

<mark style="background-color:blue;">We use MaxMind geoIP as a reference for countries, regions, and cities.</mark>

#### Example

<img src="/files/ZG437T7jjEr7m7KKHi8q" alt="" data-size="original">

</details>

<details>

<summary>City </summary>

Selection of users located in the chosen city.

For front-end implementation, this is determined by the script using the user's IP, while in API implementation, it's determined based on the user's IP passed in <mark style="color:red;">`context.device.ip`</mark> parameter.

#### Available Conditions

* is
* is not

<mark style="background-color:blue;">The region's central city is not included when choosing region.</mark>

#### Available Values

The value is taken from the reference according to the region code.

<mark style="background-color:blue;">We use MaxMind geoIP as a reference for countries, regions, and cities.</mark>

**Example**&#x20;

<img src="/files/S6wln0Pfb06Lk2GsoIyj" alt="" data-size="original">

</details>

<details>

<summary>Number of Pageviews</summary>

Selection of users who have made the specified number of pageviews on the website.

Works within the scope of an individual user.

#### Available Conditions

* Exactly
* Is not
* More than
* At least
* Less than
* At most

#### Available Values

Whole number only.

**Example**

<img src="/files/TGQ4xFBB5feEvL6FizO5" alt="" data-size="original">

</details>

<details>

<summary>New User</summary>

Checks if the user is a new or returning one.

#### Available conditions:

* Yes
* No

</details>

<details>

<summary>URL Visit </summary>

Selection of users who have visited the specified pages of the website a specified number of times.

Works within the scope of an individual user.

#### **Available Conditions**

* Is
* Is not
* Contains
* Does not contain
* [**Regexp**](/lang/en/general-information/how-to-use-regular-expressions-regex.md)

**Available Values**

Number of visits:

* Exactly
* Is not
* More than
* At least
* Less than
* At most

Whole number only.

#### **Excluding URL Parameters**

When defining a URL, you have the option to choose ”Ignore URL parameters”. By selecting this option, all visitors to the specified page will be included in the audience regardless of any URL parameters present.

<mark style="background-color:blue;">URL parameter is a "key-value" pair specified in a link. An equal sign "=" is placed between the key and the value, and an ampersand "&" is placed between different parameters. The question mark "?" is placed before the first pair. Example:</mark> <mark style="color:red;background-color:blue;">\`<http://example.com?product=1234\\&utm\\_source=gravity\\`></mark><mark style="background-color:blue;">.</mark>

#### Targeting by **URL Parameters**

It is possible to only target by a URL parameter by choosing, e.g. URL Visit *contains* <mark style="color:red;">`utm_source=gravity`</mark> and unchecking the ”Ignore URL parameters” checkbox.

**Example**

<img src="/files/SrvdDz9ZeZlY80ruPcgb" alt="" data-size="original">

</details>

<details>

<summary>Products Added To Cart </summary>

Selection of users who have added a specified number of products to the cart. Gravity Field can only consider those cart additions for which [Add To Cart events](broken://pages/FMOd2tKM4bndH01oAaI7) have been triggered.

Works within the scope of an individual user.

There is an option to choose a specific product property from a dropdown menu, and available properties are drawn from the product feed (e.g. category, product color, size, availability for order, etc.).

<mark style="background-color:blue;">To modify the list of available fields, you need to contact the personalization manager or customer support.</mark>

#### Available Conditions

* any product
* with property
* without property

#### Available Values

Number of cart additions:

* exactly
* is not
* more than
* at least
* less than
* at most

Whole number only.

**Example**

<img src="/files/CoEXU6cKRBB6jYRkd8j7" alt="" data-size="original">

</details>

<details>

<summary>Product Viewed </summary>

Selection of users who have viewed a specified number of products that meet the specified conditions.

Works within the scope of an individual user.

You have the option to choose a specific product property from a dropdown menu, and available properties are selected from the product feed (e.g. category, product color, size, availability for order, etc.).

<mark style="background-color:blue;">To modify the list of available fields, you need to contact the personalization manager or customer support.</mark>

**Available Conditions**

* any product
* with property
* without property

**Available Values**

Amount of product views:

* exactly
* is not
* more than
* at least
* less than
* at most

Whole number only.

**Example**

<img src="/files/XBGgOzUB6aLDzNhusQKP" alt="" data-size="original">

</details>

<details>

<summary>Product Purchased</summary>

Selection of users who have purchased a specified number of products that meet the specified conditions.

Works within the scope of an individual user.

You have the option to choose a specific product property from a dropdown menu, and available properties are selected from the product feed (e.g., category, product color, size, availability for order, etc.).

<mark style="background-color:blue;">To modify the list of open fields, you need to contact the personalization manager or customer support.</mark>

**General Conditions**

* any product
* with property
* without property

**Available Values**

Amount of purchases:

* exactly
* is not
* more than
* at least
* less than
* at most

Whole number only.

**Example**

<img src="/files/NFsf2k4VBWnCTKXnJ0PI" alt="" data-size="original">

</details>

<details>

<summary>Event Trigger</summary>

Selection of users who have triggered the specified number of selected events.

Works within the scope of an individual user.

You have the option to choose a specific event from a dropdown menu, and available events are selected from the overall list of events sent to the section.

**Available Values**

Amount of events:

* exactly
* is not
* more than
* at least
* less than
* at most

Whole number only.

**Example**

<img src="/files/Z6DKqFdRaiqQGDsVPzrr" alt="" data-size="original">

</details>

<details>

<summary>Event Trigger by Property </summary>

Selection of users who have triggered the specified number of selected events with a chosen property value.

Works within the scope of an individual user.

You have the option to choose a specific event from a dropdown menu, and available events are selected from the overall list of events sent to the account. You can specify any properties and values, but the users will not be added to the audience if property and value do not match those sent in the events.

**Available Conditions**

* is
* is not
* more than
* at least
* less than
* at most
* is not
* contains
* does not contain

**Available Values**

Amount of events:

* exactly
* is not
* more than
* at least
* less than
* at most

Whole number only.

**Example**

<img src="/files/3zOGjjgiOWLLFrZayYRM" alt="" data-size="original">

</details>

## 2. Attribution window

The attribution window defines the time period during which the specified conditions in the audience settings must be fulfilled for a user to be added to the audience

#### Available Values

* current session
* one day
* one week
* two weeks
* one month
* three months
* one year

#### Example

<figure><img src="/files/hdRrE7aZDA7Rn56TFWTV" alt=""><figcaption></figcaption></figure>

## 3. Retention period

The retention period specifies how long users should remain within the audience after they no longer fulfill the specified conditions set in the audience.

#### Available values

Values are indicated in days (whole number).

#### Example

<div align="left"><figure><img src="/files/LRLLrmyjAnRRVw8scjyg" alt="" width="351"><figcaption></figcaption></figure></div>

## Audience examples

<details>

<summary><strong>Using Country and City conditions</strong></summary>

Example: To create an audience that includes users from all over the US except New York:

1. In the Condition section, select the Country parameter and set the condition to <mark style="color:red;">`is`</mark> United States.
2. Select the operand <mark style="color:red;">`AND`</mark>.
3. In the Condition section, select the City parameter and set the condition to <mark style="color:red;">`is not`</mark> New York (the dropdown list will suggest available options as you type).

<img src="/files/VZfIDChzuf2pYQ9ylqPh" alt="" data-size="original">

</details>

<details>

<summary><strong>Using </strong><mark style="color:red;"><strong><code>is not</code></strong></mark><strong> condition</strong></summary>

Example: To create an audience that excludes users from both Washington and New York:

1. In the Condition section, select the City parameter and set the condition to <mark style="color:red;">**`is not`**</mark> Washington (the dropdown list will suggest available options as you type).
2. Select the operand <mark style="color:red;">**`AND`**</mark>.
3. In the Condition section, select the City parameter and set the condition to <mark style="color:red;">**`is not`**</mark> New York.

<img src="/files/vrTXXzn6ZmOnS68xVLxG" alt="" data-size="original">

<mark style="background-color:blue;">Please note that in this example, only the \`AND\` operand will solve the task. When using the \`OR\` operand, a user will be included in the targeting if they are not located in at least one city from the set "Washington, New York." This condition will match all users since a user can only be in one city.</mark>

</details>

<details>

<summary><strong>Excluding Secondary Audience</strong></summary>

Example: creating an audience of users who abandoned their cart on the website (or in the app).&#x20;

This audience should include users who added items to their cart but did not complete the purchase. It's important to exclude those users who are still in the process of making a purchase. To achieve this, you need to create a secondary audience of users who added items to their cart during the current session or within a day (in the example, this audience is "Cart additions (1 day)"), and then exclude this audience from the main audience you are creating.

<img src="/files/NGjj8xCMK4kc3h7mi1ue" alt="" data-size="original">

</details>

[^1]:


---

# 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://developer.gravityfield.ai/lang/en/platform-interface/audience-targeting-conditions.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.
