Create action

Attention.

Access tokens will not be accepted in URL parameters starting February 13, 2019. To continue working with the Yandex.Metrica API, set up authorization by passing the token in the HTTP header.

The outdated authorization method will be temporarily disabled on January 23, January 30, and February 6 for maintenance. Authorization using URL parameters will be unavailable on these dates.

Creates action for counter.

  1. Request syntax
  2. Request message body
  3. Response format

Request syntax

counterId — counter ID, for which you must create an action.

https://api-metrica.yandex.net/management/v1/counter/{counterId}/operations
 ? 

Request message body


{
    "operation" : {
        "action" :  < operation_type > ,
        "attr" :  < operation_attribute > ,
        "value" :  < string > ,
        "status" :  < operation_status > 
    }
}
Parameters Description
operation Action.
operation
action Action type.

Possible values:

  • cut_parameter — remove specific parameter from URL;
  • replace_domain — replace domain.
  • to_lower — convert to lower case;
  • merge_https_and_http — replace https:// with http://;
  • cut_fragment — remove anchor from URL;
  • cut_all_parameters — cut all parameters from URL;
attr Field for filtration.

Possible values:

  • referer — referrer;
  • url — page URL.
value Value for replacement.
status Action status.

Possible values:

  • active — action is used;
  • disabled — action disabled (without deletion).

Request example

POST https://api-metrica.yandex.net/management/v1/counter/{counterId}/operations?

Response format


{
    "operation" : {
        "id" :  < int > ,
        "action" :  < operation_type > ,
        "attr" :  < operation_attribute > ,
        "value" :  < string > ,
        "status" :  < operation_status > 
    }
}
Parameters Description
operation Action.
operation
id

Action ID (needs to be specified while changing a counter action).

action Action type.

Possible values:

  • cut_parameter — remove specific parameter from URL;
  • replace_domain — replace domain.
  • to_lower — convert to lower case;
  • merge_https_and_http — replace https:// with http://;
  • cut_fragment — remove anchor from URL;
  • cut_all_parameters — cut all parameters from URL;
attr Field for filtration.

Possible values:

  • referer — referrer;
  • url — page URL.
value Value for replacement.
status Action status.

Possible values:

  • active — action is used;
  • disabled — action disabled (without deletion).