# Targeting conditions definition and their applicability

Created: 26.01.2023

Updated: 08.11.2023

Author: Polina A.

{% hint style="info" %}
Creating suitable content for a specific user begins with configuring your targeting.
{% endhint %}

## **Targeting**

Targeting consists of three blocks:

1. Who? — to whom will the experience be shown (device type, browser type, session behavior, audience, etc.)?
2. Where? — where will it be displayed (page type, address)?
3. When? — when will it be displayed (date, time)?

<mark style="color:green;">**The applicability**</mark> of targeting conditions for Frontend and API implementations is highlighted in color.

## **Who?**

<details>

<summary>Audience: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:** belongs to; does not belong to
2. **Description:** select audiences from a dropdown menu of all those created by any user in this section.

</details>

<details>

<summary>Browser: <mark style="color:green;">Front / API</mark></summary>

1. **Condition:** is, is not
2. **Possible values:** Chrome, Safari, Firefox, Opera, Edge, Yandex, Android Browser, Samsung Internet, MIUI Browser, Internet Explorer, Other
3. **Description:** determined by script in Frontend implementation and in API implementation is determined based on the value in <mark style="color:red;">**`context.device.userAgent`**</mark>

</details>

<details>

<summary>Traffic Source: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:** is, is not
2. **Possible values:** Direct, Paid Search, Referral, Search, Social
3. **Description:** traffic source; determined by script in Frontend implementation and in API implementation is determined based on <mark style="color:red;">**`context.page.referrer`**</mark>. For details see: [Traffic Sources Identification](https://developer.gravityfield.ai/lang/en/general-information/traffic-sources-identification)

</details>

<details>

<summary>Device Category: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:** is, is not
2. **Possible values:** Desktop, Smartphone, Tablet
3. **Description:** determined by script in Frontend implementation and in API implementation is determined based on the value in <mark style="color:red;">**`context.device.userAgent`**</mark>.

</details>

<details>

<summary>Country: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:** is, is not
2. **Description:** user's country. Value taken from reference based on country code. Determined based on user's IP passed in <mark style="color:red;">**`context.device.ip`**</mark> in API implementation.

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

</details>

<details>

<summary>Region: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:** is, is not
2. **Description:** user's region. The value is taken from the reference based on region code. Determined based on the user's IP passed in <mark style="color:red;">**`context.device.ip`**</mark> in API implementation.&#x20;

**Note: The selected area does not include regional cities.**

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

</details>

<details>

<summary>City: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:** is, is not
2. **Description:** user's city. The value is taken from the reference based on city ID. Determined based on the user's IP passed in <mark style="color:red;">**`context.device.ip`**</mark> in API implementation.

&#x20;**Note: The selected city does not include the region.**

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

</details>

<details>

<summary>Number of Pageviews: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:** exactly, is not, more than, at least, less than, at most
2. **Limitations:** works within a session;

</details>

<details>

<summary>New User: <mark style="color:green;"><strong>Front</strong></mark></summary>

1. **Condition:** Yes, No;

</details>

<details>

<summary>Cookie: <mark style="color:green;"><strong>Front</strong></mark></summary>

1. **Condition:** exactly, is not, more than, at least, less than, at most, contains, exists, does not exist;

</details>

<details>

<summary>URL visit: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:**

&#x20;   a. Address: is, is not, contains, does not contain, [**regexp**](https://developer.gravityfield.ai/lang/en/general-information/how-to-use-regular-expressions-regex),&#x20;

&#x20;   b. Visit Count: exactly, is not, more than, at least, less than, at most

2. **Limitations:** works within a session;

</details>

<details>

<summary>Products Added to Cart: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:**

&#x20;      a. Product: any product, with property, without property

&#x20;      b. Quantity: exactly, is not, more than, at least, less than, at most

2. **Limitations:** works within a session;
3. **Description:** users who triggered a specified number of <mark style="color:red;">`Add-to-cart`</mark> events. This condition consists of two parts, allowing for a more precise setup:

&#x20;      a. Option to count any product added to cart

&#x20;       or

&#x20;      b. Highlighting a group of products with a specific property or without it

&#x20;      c. When no property is specified, only users who added any product to the cart are   included in the audience.

Property is a parameter describing the product specified in the feed, such as category, product color, size, availability for order, etc.&#x20;

<mark style="background-color:blue;">Only a limited set of properties are available by default and are chosen in feed settings. To add or exclude properties, you can contact the team working on your project.</mark>

</details>

<details>

<summary>Products Viewed: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:**

&#x20;       a. Product: any product, with property, without property

&#x20;       b. Number of Views: exactly, is not, more than, at least, less than, at most

2. **Limitations:** works within a session;
3. **Description:** users who viewed a specified number of products. This condition consists of two parts, allowing for a more precise setup:

&#x20;      a. Option to consider any product viewed by the user&#x20;

&#x20;      or

&#x20;      b. Highlighting a group of products with a specific property or without it.

&#x20;      c. When no property is specified, only users who viewed at least one product are   included in the audience.

Property is a parameter describing the product specified in the feed, such as category, product color, size, availability for order, etc.

<mark style="background-color:blue;">Only a limited set of properties are available by default and are chosen in feed settings. To add or exclude properties, you can contact the team working on your project.</mark>

</details>

<details>

<summary>Products Purchased: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:**

&#x20;      a. Product: any product, with property, without property

&#x20;      b. Quantity: exactly, is not, more than, at least, less than, at most

2. **Limitations:** works within a session;
3. **Description:** users who made a specified number of purchases. This condition consists of two parts, allowing for a more precise setup:&#x20;

&#x20;      a. Option to consider any product purchased by the user&#x20;

&#x20;      or

&#x20;     b. Highlighting a group of products with a specific property or without it.

&#x20;     c. When no property is specified, only users who purchased any product are included in the audience.

Property is a parameter describing the product specified in the feed, such as category, product color, size, availability for order, etc.

<mark style="background-color:blue;">Only a limited set of properties are available by default, chosen in feed settings. To add or exclude properties, you can contact the team working on your project.</mark>

</details>

<details>

<summary>Custom Attribute: <mark style="color:green;"><strong>API</strong></mark></summary>

1. **Condition:** is, is not, contains, array contains, more than, at least, less than, at most, [regexp](https://app.gitbook.com/o/EEasDkRclT6ZeuxuncO3/s/gMtBULwktLmojWzNHUD1/~/changes/8/general-information/reviewed-how-to-use-regular-expressions-regex);
2. **Description:** clarification of a specific attribute and its value;
3. **Limitations:** Works similarly to "**Where** / Custom evaluator" in Frontend campaigns

</details>

<details>

<summary>Event Trigger <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:**

&#x20;      a. Event Type: any event received by the platform;

&#x20;      b. exactly, is not, more than, at least, less than, at most;

2. **Description:** targeting for the hitting of a specific event in a specified quantity;

</details>

<details>

<summary>Event Trigger By Property <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:**

&#x20;      a. Event Type: any event received by the platform;

&#x20;      b. Property Name;

&#x20;      c. Value condition: is, is not, more than, at least, less than, at most, is not, contains, does not contain;

&#x20;      d. Property Value;

&#x20;      e. Event send count condition: exactly, is not, more than, at least, less than, at most;

<img src="https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FwCLNKaWescHufKtggm0X%2FUntitled%20(3).png?alt=media&#x26;token=81d78ce6-bed6-4ecf-8322-e923578c6709" alt="" data-size="original">

2. **Description:** targeting for the hitting of a specific event in a specified quantity tied to its name and value;

</details>

<details>

<summary>Landing URL (SOON Front)</summary>

</details>

<details>

<summary>Operating System (SOON Front)</summary>

</details>

## **Where?**

<details>

<summary>Page URL: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition**: is, is not, contains, does not contain, [regexp](https://app.gitbook.com/o/EEasDkRclT6ZeuxuncO3/s/gMtBULwktLmojWzNHUD1/~/changes/8/general-information/reviewed-how-to-use-regular-expressions-regex);
2. **Data type:** string;
3. **Description:** page URL. It can be used in conjunction with the “ignore URL parameters” checkbox, which allows to consider URL parameters in the condition;

</details>

<details>

<summary>Category page: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:** is, is not;
2. **Description:** catalog page URL, is determined based on information from the Page Context (set during implementation);

</details>

<details>

<summary>Product page: <mark style="color:green;"><strong>Front / API</strong></mark></summary>

1. **Condition:** any product, with property, without property;
2. **Description:** product page URL, is determined based on information from the Page Context (set during implementation), targeting conditions are defined based on the feed data;

<mark style="background-color:blue;">Only a limited set of properties are available by default and are chosen in feed settings. To add or exclude properties, you can contact the team working on your project.</mark>

</details>

<details>

<summary>Product popularity (views): <mark style="color:green;"><strong>Front</strong></mark></summary>

1. **Conditions:**

&#x20;      a. Inclusion condition: exactly, is not, more than, at least, less than, at most;

&#x20;      b. Time frame: day, 2 days, week, 2 weeks, month;

2. **Description:** number of product card views in a specified time period;

</details>

<details>

<summary>Product Popularity (purchases)<mark style="color:green;">: <strong>Front</strong></mark></summary>

1. **Conditions:**

&#x20;     a. Inclusion condition: exactly, is not, more than, at least, less than, at most;

&#x20;     b. Time frame: day, 2 days, week, 2 weeks, month;

2. **Description:** number of product purchases within a specified time period;

</details>

<details>

<summary>Custom evaluator: <mark style="color:green;"><strong>Front</strong></mark></summary>

Is equivalent to Custom attribute (API).

1. **Description:** select from the list of evaluators created in the section
2. **Limitations:** Works similarly to "**Who** / Custom Attribute" in API campaigns

An evaluator can be created directly from targeting. During targeting setup, clicking on the "plus" icon (screenshot 1) will open a new tab where you can specify the necessary evaluator code (screenshot 2).

![](https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FtAcF8kLyGBWpWHxndCZW%2FUntitled%20\(7\).png?alt=media\&token=a06e35d2-cc23-4f46-bf1f-82454824ab29)

![](https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FalIFsYQI0OcqfPuBHst2%2FUntitled%20\(8\).png?alt=media\&token=061376c6-8787-4c98-941b-6544257d6de9)

More about Evaluators: [evaluators](https://developer.gravityfield.ai/lang/en/general-information/evaluators "mention")

</details>

## **When?**

<details>

<summary>Time Zone: <mark style="color:green;">Front / API</mark></summary>

1. Section time zone
2. User time zone

</details>

<details>

<summary>Day of week: <mark style="color:green;">Front / API</mark></summary>

![](https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FaBgPbacCm1r00h3JtKik%2FUntitled%20\(2\).png?alt=media\&token=f83885a0-6a99-4f4b-8676-1fc1631a2b8c)

</details>

<details>

<summary>Time of day: <mark style="color:green;">Front / API</mark></summary>

![](https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FLXxgWNoaJXik7xmIt8Yk%2FUntitled%20\(3\).png?alt=media\&token=b92251c2-6e64-42bc-a92d-7852646216e1)

</details>

<details>

<summary>Set Schedule: <mark style="color:green;">Front / API</mark></summary>

To set a specific time range in which experience need to be active, click "Set Schedule" in it's field:

![](https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FuVfey9sgqeejBy47RyD5%2F2023-11-08_17-00-22.png?alt=media\&token=87b30e8a-3284-441b-9f8a-a977529e5e26)

In pop-up you can choose:

1. Start and end dates of the experience
2. Exact start and end time of the experience
3. Time zone - section's or user's

![](https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FRbbYRCUlqKhDejpMeOUJ%2F2023-11-08_17-10-54.png?alt=media\&token=be3ac591-d7ec-4764-8355-672261256acb)

While choosing start and end dates, choose the date in the calendar opened.

![](https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FxnGGYIq3x4XzRGH5ScwN%2F2023-11-08_17-02-32.png?alt=media\&token=95319f0a-4e32-4d80-9a77-f7d1bb74ce73)

</details>

## Applying **of Conditions: examples**

<details>

<summary>"Contains A" and "Does not contain B" using the example of the user's city</summary>

Example: you want to set up targeting for all of the United States except New York. To achieve this, you need to set 2 conditions:

1. In the Conditions section, select the parameter: Country <mark style="color:red;">is</mark> United States
2. Select the **AND** operand
3. In the same Conditions section, add another parameter: City <mark style="color:red;">is not</mark> New York (the dropdown list will suggest available options as you type).

![](https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FPEuIQkvNash1aBvPr5Hw%2Fimage.png?alt=media\&token=c63a5d50-ee76-4a20-8691-484c1a57a0cc)

<mark style="background-color:red;">Important: The selected region does not include the region's central city. Example: when selecting the region "New York" for targeting, New York City will not be included in the targeting.</mark>

</details>

<details>

<summary>Negative Values in Conditions</summary>

Example: you want to set up targeting where the user should not be located in cities like New York and Washington.&#x20;

In this case, the correct format would be "City - <mark style="color:red;">**`NOT`**</mark> New York <mark style="color:red;">**`AND NOT`**</mark> Washington". The format "City - <mark style="color:red;">**`NOT`**</mark> New York <mark style="color:red;">**`OR NOT`**</mark> Washington" is incorrect and will not work.

![](https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FP0xWfGsjmvOjNmZEo1PM%2Fimage.png?alt=media\&token=340a59ea-94e3-422c-9acd-e25d9fcc4988)

</details>

<details>

<summary>Excluding Audiences (Abandoned Cart)</summary>

Example: you want to create an audience that includes users who have abandoned their cart on the website (or in the app). The audience should consist of users who added items to their cart but did not complete the purchase.&#x20;

However, if you only rely on the two conditions mentioned earlier, the audience would include all users who visited the site and added items to their cart. To prevent the audience from being inflated with users who are just filling up the cart but don't intend to abandon it, you can create a separate audience of users who added items to their cart during the current session or within a day and then exclude this audience from the one you're creating.

<img src="https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FpmmQZQRuD3akiGLhi7fY%2FUntitled%20(1)%20(1).png?alt=media&#x26;token=898a9676-808f-46e6-8e79-265745daee52" alt="" data-size="original">

</details>

## **Excluding URL Parameters:**

The condition can include an additional parameter <mark style="color:red;">**`ignoreUrlParams=1`**</mark> if you need to compare URLs without taking parameters into account.

{% hint style="info" %}
The URL parameter is a property added to the dashboard for triggering actions. By adding parameters to the click URL, you can track information about clicks. The URL parameter consists of a "key-value" pair. An equal sign "=" is used between the key and the value, and an ampersand "&" is used between different parameters. The question mark "?" is placed before the first parameter. Example: <mark style="color:red;">\`<http://example.com?product=1234\\&utm\\_source=gravity\\`>.</mark>
{% endhint %}

In the interface:

<figure><img src="https://3786223776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMtBULwktLmojWzNHUD1%2Fuploads%2FuMyt9G7QdjcjJHRhe5pa%2FUntitled%20(7).png?alt=media&#x26;token=f7519113-dd0f-4984-8e6d-46a66fd50cc5" alt=""><figcaption></figcaption></figure>
