Creating a filter

Creates a tag filter.

Request syntax

counterId: ID of the tag for which you want to create a filter.

POST https://api-metrika.yandex.net/management/v1/counter/{counterId}/filters

In the request 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 apply the filter to.

Possible values:

  • referer: Referrer.
  • uniq_id: Special filter attribute “Don't count my sessions”.
  • client_ip: IP address.
  • title: Page title.
  • url: Page URL.
type Filter type or action for filter.

Possible values:

  • equal: Equal to.
  • contain: Contains.
  • me: My visits, used only with the data type attr = uniq_id.
  • start: Starts with.
  • interval: In the interval, used only with the data type “Ipad dress” (attr = client_ip).
  • only_mirrors: Only site and mirrors, used only for the data type “page URL” (attr = url) and the filter type “only record traffic” (action = include), as well as when mirrors are specified for the tag.
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.
Parameters Description
filter Filter.
filter
attr Type of data to apply the filter to.

Possible values:

  • referer: Referrer.
  • uniq_id: Special filter attribute “Don't count my sessions”.
  • client_ip: IP address.
  • title: Page title.
  • url: Page URL.
type Filter type or action for filter.

Possible values:

  • equal: Equal to.
  • contain: Contains.
  • me: My visits, used only with the data type attr = uniq_id.
  • start: Starts with.
  • interval: In the interval, used only with the data type “Ipad dress” (attr = client_ip).
  • only_mirrors: Only site and mirrors, used only for the data type “page URL” (attr = url) and the filter type “only record traffic” (action = include), as well as when mirrors are specified for the tag.
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.

Sample request

POST https://api-metrika.yandex.net/management/v1/counter/{counterId}/filters

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 tag filter

attr Type of data to apply the filter to.

Possible values:

  • referer: Referrer.
  • uniq_id: Special filter attribute “Don't count my sessions”.
  • client_ip: IP address.
  • title: Page title.
  • url: Page URL.
type Filter type or action for filter.

Possible values:

  • equal: Equal to.
  • contain: Contains.
  • me: My visits, used only with the data type attr = uniq_id.
  • start: Starts with.
  • interval: In the interval, used only with the data type “Ipad dress” (attr = client_ip).
  • only_mirrors: Only site and mirrors, used only for the data type “page URL” (attr = url) and the filter type “only record traffic” (action = include), as well as when mirrors are specified for the tag.
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 in the range.
end_ip Last IP address in the range.
with_subdomains Filter by subdomains.
Parameters Description
filter Filter.
filter
id

Filter ID. Specify this parameter when changing a tag filter

attr Type of data to apply the filter to.

Possible values:

  • referer: Referrer.
  • uniq_id: Special filter attribute “Don't count my sessions”.
  • client_ip: IP address.
  • title: Page title.
  • url: Page URL.
type Filter type or action for filter.

Possible values:

  • equal: Equal to.
  • contain: Contains.
  • me: My visits, used only with the data type attr = uniq_id.
  • start: Starts with.
  • interval: In the interval, used only with the data type “Ipad dress” (attr = client_ip).
  • only_mirrors: Only site and mirrors, used only for the data type “page URL” (attr = url) and the filter type “only record traffic” (action = include), as well as when mirrors are specified for the tag.
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 in the range.
end_ip Last IP address in the range.
with_subdomains Filter by subdomains.