Add

Creates a retargeting condition.

Attention.

Disabled method. Use version 5 of the API.

For information about the compatibility of methods between versions Live 4 and 5, see the Migration guide.

Input data

The input data structure in JSON is shown below.

{
   "method": "RetargetingCondition",
   "param": {
      /* RetargetingConditionRequest */
      "Action": (string),
      "RetargetingConditions": [
         {  /* RetargetingCondition */
            "RetargetingConditionName": (string),
            "RetargetingConditionDescription": (string),
            "Login": (string),
            "RetargetingCondition": [
               {  /* RetargetingConditionItem */
                  "Type": (string),
                  "Goals": [
                     {  /* RetargetingConditionGoalItem */
                        "Time": (int),
                        "GoalID": (long)
                     }
                     ...
                  ] 
               } 
               ...
            ]
         }
         ...
      ]
   }
}

Parameters are described below.

Parameter Description Required
RetargetingConditionRequest object
Action Action: Add. Yes
RetargetingConditions Array of RetargetingCondition objects containing information about retargeting conditions. Yes
RetargetingCondition object
RetargetingConditionName Name of the retargeting condition (maximum 250 characters). Yes
RetargetingConditionDescription Text description of the retargeting condition (maximum 4096 characters). No
Login

Username of the condition's owner.

Direct advertisers set their own Yandex username; advertising agencies set their client's username.

Yes
RetargetingCondition Array of RetargetingConditionItem objects. Each object contains a group that describes the desired user behavior. If the retargeting condition has several groups, they are united with the logical AND operator (the condition is satisified if all the groups of goals are achieved). Yes
RetargetingConditionItem object
Type

Type of group:

  • all — The group is satisfied if all the goals and segments are met.
  • or — The group is satisfied if at least one of the goals or segments is met.
  • not — The group is satisfied if none of the goals or segments is met.

A retargeting condition that uses Yandex Metrica segments or Yandex Audience segments must contain at least one "all" or "or" type of group. A retargeting condition that consists solely of "not" groups can only use Yandex Metrica goals.

Yes
Goals Array of goals and segments (RetargetingConditionGoalItem objects). Yes
RetargetingConditionGoalItem object
Time

Number of days (from 1 to 90) for checking whether goals are completed or segments are matched.

For Yandex Metrica goals and segments
GoalID ID of the goal or segment. Yes
Parameter Description Required
RetargetingConditionRequest object
Action Action: Add. Yes
RetargetingConditions Array of RetargetingCondition objects containing information about retargeting conditions. Yes
RetargetingCondition object
RetargetingConditionName Name of the retargeting condition (maximum 250 characters). Yes
RetargetingConditionDescription Text description of the retargeting condition (maximum 4096 characters). No
Login

Username of the condition's owner.

Direct advertisers set their own Yandex username; advertising agencies set their client's username.

Yes
RetargetingCondition Array of RetargetingConditionItem objects. Each object contains a group that describes the desired user behavior. If the retargeting condition has several groups, they are united with the logical AND operator (the condition is satisified if all the groups of goals are achieved). Yes
RetargetingConditionItem object
Type

Type of group:

  • all — The group is satisfied if all the goals and segments are met.
  • or — The group is satisfied if at least one of the goals or segments is met.
  • not — The group is satisfied if none of the goals or segments is met.

A retargeting condition that uses Yandex Metrica segments or Yandex Audience segments must contain at least one "all" or "or" type of group. A retargeting condition that consists solely of "not" groups can only use Yandex Metrica goals.

Yes
Goals Array of goals and segments (RetargetingConditionGoalItem objects). Yes
RetargetingConditionGoalItem object
Time

Number of days (from 1 to 90) for checking whether goals are completed or segments are matched.

For Yandex Metrica goals and segments
GoalID ID of the goal or segment. Yes

Output data

Attention. An error when adding one of the retargeting conditions does not cause the entire operation to be canceled, and does not affect the success of adding other retargeting conditions.

The output data structure in JSON is shown below.

{
   "data": {
      /* RetargetingConditionResponse */
      "ActionsResult": [
         {  /* RetargetingConditionActionResult */
            "Warnings": [
               {  /* Warning */
                  "WarningCode": (int),
                  "WarningString": (string),
                  "Description": (string)
               }
               ...
            ],
            "Errors": [
               {  /* Error */
                  "FaultCode": (int),
                  "FaultString": (string),
                  "FaultDetail": (string)
               }
               ...
            ],
            "RetargetingConditionID": (int)
         }
         ...
      ]
   }
}

Parameters are described below.

Parameter Description
RetargetingConditionResponse object
ActionsResult

Array of RetargetingConditionActionResult objects. Each object corresponds to an item in the RetargetingConditions input array.

  • If the operation was completed successfully, the object contains the ID of the added/updated retargeting condition.
  • If the operation was completed but issues occurred during the operation, the object contains the ID of the added/updated retargeting condition and a Warnings array containing a description of those issues.
  • The Errors array, if an error occurred.

The items in the array are in the same order as the objects in the RetargetingConditions input array.

RetargetingConditionActionResult object
Warnings Array of Warning objects describing issues that occurred while performing the operation.
Errors Array of Error objects with errors that occurred while performing the operation.
RetargetingConditionID ID of the retargeting condition.
Warning object
WarningCode Warning code.
WarningString Warning text.
Description Warning description in JSON format.
Error object
FaultCode Error code.
FaultString Textual message about the error.
FaultDetail Detailed description of the reason for the error.
Parameter Description
RetargetingConditionResponse object
ActionsResult

Array of RetargetingConditionActionResult objects. Each object corresponds to an item in the RetargetingConditions input array.

  • If the operation was completed successfully, the object contains the ID of the added/updated retargeting condition.
  • If the operation was completed but issues occurred during the operation, the object contains the ID of the added/updated retargeting condition and a Warnings array containing a description of those issues.
  • The Errors array, if an error occurred.

The items in the array are in the same order as the objects in the RetargetingConditions input array.

RetargetingConditionActionResult object
Warnings Array of Warning objects describing issues that occurred while performing the operation.
Errors Array of Error objects with errors that occurred while performing the operation.
RetargetingConditionID ID of the retargeting condition.
Warning object
WarningCode Warning code.
WarningString Warning text.
Description Warning description in JSON format.
Error object
FaultCode Error code.
FaultString Textual message about the error.
FaultDetail Detailed description of the reason for the error.

Examples of input data

Python

{
   'Action': 'Add',
   'RetargetingConditions': [
      {
         'RetargetingConditionName': u'Order incomplete',
 'RetargetingConditionDescription': u'Added items to basket but didn't complete the order',
 'Login': 'agrom',
 'RetargetingCondition': [
            {
               'Type': 'or',
               'Goals': [
                  {  
                     'Time': 14,
                     'GoalID': 1557799
                  },
                  {  
                     'Time': 14,
                     'GoalID': 1558005
                  }
               ]
            },
            {
               'Type': 'not',
               'Goals': [
                  {  
                     'Time': 11,
                     'GoalID': 1559911
                  }
               ]
            }
         ]
      }
   ]
}

PHP

array(
   'Action' => 'Add',
   'RetargetingConditions' => array(
      array(
         'RetargetingConditionName' = > 'Order incomplete',
 'RetargetingConditionDescription' = > 'Added items to basket but didn't complete the order',
 'Login' = > 'agrom',
 'RetargetingCondition' = > array(
            array(
               'Type' => 'or',
               'Goals' => array(
                  array(
                     'Time' => 14,
                     'GoalID' => 1557799
                  ),
                  array(
                     'Time' => 14,
                     'GoalID' => 1558005
                  )
               )
            ),
            array(
               'Type' => 'not',
               'Goals' => array(
                  array(
                     'Time' => 11,
                     'GoalID' => 1559911
                  )
               )
            )
         )
      )
   )
)

Perl

{
   'Action' => 'Add',
   'RetargetingConditions' => [
      {
         'RetargetingConditionName' => 'Order incomplete',
 'RetargetingConditionDescription' => 'Added items to basket but didn't complete the order',
 'Login' => 'agrom',
 'RetargetingCondition' => [
            {
               'Type' => 'or',
               'Goals' => [
                  {  
                     'Time' => 14,
                     'GoalID' => 1557799
                  },
                  {  
                     'Time' => 14,
                     'GoalID' => 1558005
                  }
               ]
            },
            {
               'Type'  => 'not',
               'Goals' => [
                  {  
                     'Time' => 11,
                     'GoalID' => 1559911
                  }
               ]
            }
         ]
      }
   ]
}