Update

Changes a retargeting condition.

Attention.

This method is outdated and will soon be disabled. Use version 5 of the API.

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

Restrictions

If a retargeting condition contains at least one "all" or "or" type of group, after editing, it still must contain at least one "all" or "or" group.

If a retargeting condition contains only "not" groups, it still must contain only "not" groups after editing.

Input data

The input data structure in JSON is shown below.

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

Parameters are described below.

ParameterDescriptionRequired
RetargetingConditionRequest object
ActionAction: Update.Yes
RetargetingConditionsArray of RetargetingCondition objects containing information about retargeting conditions.Yes
RetargetingCondition object
FieldsNames of parameters to be updated. If omitted, all parameters will be updated (and if the value is not set, they will be reset).No
RetargetingConditionNameName of the retargeting condition (maximum 250 characters).No
RetargetingConditionDescriptionText description of the retargeting condition (maximum 4096 characters).No
RetargetingConditionID

ID of the retargeting condition.

Yes
RetargetingConditionArray 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
GoalsArray 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
GoalIDID of the goal or segment.Yes

Output data

Attention. An error when changing one of the retargeting conditions does not cause the entire operation to be canceled, and does not affect the success of changing 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.

ParameterDescription
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
WarningsArray of Warning objects describing issues that occurred while performing the operation.
ErrorsArray of Error objects with errors that occurred while performing the operation.
RetargetingConditionIDID of the retargeting condition.
Warning object
WarningCodeWarning code.
WarningStringWarning text.
DescriptionWarning description in JSON format.
Error object
FaultCodeError code.
FaultStringTextual message about the error.
FaultDetailDetailed description of the reason for the error.

Examples of input data

Python

{
   'Action': 'Update',
   'RetargetingConditions': [
      {
         'Fields': ['RetargetingCondition'],
         'RetargetingConditionID': 123789,
         'RetargetingCondition': [
            {
               'Type': 'or',
               'Goals': [
                  {  
                     'Time': 14,
                     'GoalID': 1557799
                  },
                  {  
                     'Time': 14,
                     'GoalID': 1558005
                  }
               ]
            }
         ]
      }
   ]
}

PHP

array(
   'Action' => 'Update',
   'RetargetingConditions' => array(
      array(
         'Fields' => array('RetargetingCondition'),
         'RetargetingConditionID' => 123789,
         'RetargetingCondition' => array(
            array(
               'Type' => 'or',
               'Goals' => array(
                  array(
                     'Time' => 14,
                     'GoalID' => 1557799
                  ),
                  array(
                     'Time' => 14,
                     'GoalID' => 1558005
                  )
               )
            )
         )
      )
   )
)

Perl

{
   'Action' => 'Update',
   'RetargetingConditions' => [
      {
         'Fields' => ['RetargetingCondition'],
         'RetargetingConditionID' => 123789,
         'RetargetingCondition' => [
            {
               'Type' => 'or',
               'Goals' => [
                  {  
                     'Time' => 14,
                     'GoalID' => 1557799
                  },
                  {  
                     'Time' => 14,
                     'GoalID' => 1558005
                  }
               ]
            }
         ]
      }
   ]
}