Changing filter

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.

Changes setting of specified counter filter.

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

Request syntax

counterId — counter ID, the filter of which you want to change.

filterId — filter ID, the setting of which you want to change.

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

Request message body


{
    "filter" : {
        "attr" :  < filter_attribute > ,
        "type" :  < filter_type > ,
        "value" :  < string > ,
        "action" :  < filter_action > ,
        "status" :  < filter_status > ,
        "with_subdomains" :  < boolean > 
    }
}
Parameters Description
filter Filter.
filter
attr Type of data, to which a filter is applied.

Possible values:

  • referer — referrer;
  • uniq_id — special filter attribute “don't factor in my sessions”.
  • client_ip — IP-address;
  • title — page title;
  • url — page URL;
type Filter type or action for filter.

Possible values:

  • equal — equals;
  • contain — contains;
  • me — my visits, used only with the type of data attr = uniq_id;
  • start — begins with;
  • interval — in the interval, is used only with data type “IP-address” (attr = client_ip);
  • only_mirrors — only site and mirrors, used only for data type “page URL” (attr = url) and filter type “only record traffic” (action = include), as well as when mirrors are specified for the counter.
value Filter value.
action Filter type.

Possible values:

  • include — keep traffic only.
  • exclude — exclude traffic;
status Filter status.

Possible values:

  • active — filter is used;
  • disabled — filter disabled (without deletion).
with_subdomains Filter by subdomains.

Request example

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

Response format


{
    "filter" : {
        "id" :  < int > ,
        "attr" :  < filter_attribute > ,
        "type" :  < filter_type > ,
        "value" :  < string > ,
        "action" :  < filter_action > ,
        "status" :  < filter_status > ,
        "start_ip" :  < string > ,
        "end_ip" :  < string > ,
        "with_subdomains" :  < boolean > 
    }
}
Parameters Description
filter Filter.
filter
id

Filter ID. Specify this parameter when changing a counter filter

attr Type of data, to which a filter is applied.

Possible values:

  • referer — referrer;
  • uniq_id — special filter attribute “don't factor in my sessions”.
  • client_ip — IP-address;
  • title — page title;
  • url — page URL;
type Filter type or action for filter.

Possible values:

  • equal — equals;
  • contain — contains;
  • me — my visits, used only with the type of data attr = uniq_id;
  • start — begins with;
  • interval — in the interval, is used only with data type “IP-address” (attr = client_ip);
  • only_mirrors — only site and mirrors, used only for data type “page URL” (attr = url) and filter type “only record traffic” (action = include), as well as when mirrors are specified for the counter.
value Filter value.
action Filter type.

Possible values:

  • include — keep traffic only.
  • exclude — exclude traffic;
status Filter status.

Possible values:

  • active — filter is used;
  • disabled — filter disabled (without deletion).
start_ip First IP-address range.
end_ip Last IP-address of range.
with_subdomains Filter by subdomains.