List of available counters

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.

Returns a list of existing counters available to user.

  1. Request syntax
  2. Response format

Request syntax

https://api-metrica.yandex.net/management/v1/counters
 ? [callback=<string>]
 & [favorite=<boolean>]
 & [field=<string>]
 & [label_id=<integer>]
 & [offset=<int>]
 & [per_page=<int>]
 & [permission=<string>]
 & [reverse=<boolean>]
 & [search_string=<string>]
 & [sort=<counters_sort>]
 & [status=<counter_status>]
 & [type=<counter_type>]
Query parameters
callbackCallback function which returns an API response.
favoriteFilter by counters, which were added to Favorites.

Default value: 0

field

One or more additional parameters for the object to return. Specify the names of additional parameters in any order, and use a comma without spaces to separate them. For example: field=goals,mirrors,grants,filters,operations.

label_idTag filter
offsetSerial number of counter, from which begins output of list of counters. First counter has the number 1.

Default value: 1

per_pageNumber of counters that you want to receive.

Default value: 1000

permission

Filter by level of access to counter. Parameter can contain several values, separated by commas.

Allowed values:

  • own ― counter belonging to the user;
  • view ― guest counter with access level of “page views only”;
  • edit ― guest counter with access level “full access”.
reverseDisplay counters in ascending or descending order.

Default value: true

search_stringFilter by string. Counters, ID, name, site or mirrors which contain specified substring will be shown.
sortSorting

Default value: Default

Allowed values:

  • Uniques — Number of users
  • Hits — Page depth
  • Visits — Number of visits
  • Default — Default
  • None — No sorting
  • Name — Counter name
statusFilter by status of counter. Enabled by default.

Default value: Active

Allowed values:

  • Active — Counter active
  • Deleted — Counter deleted
typeFilter by counter type.

Allowed values:

  • partner — counter imported from YAN.
  • simple — counter created by user in Yandex.Metrica;

Response format


{
    "rows" :  < int > ,
    "counters" : [ {
        "id" :  < int > ,
        "status" :  < counter_status > ,
        "owner_login" :  < string > ,
        "code_status" :  < code_status > ,
        "code_status_info" : {
            "length" :  < integer > ,
            "found" :  < integer > ,
            "match" :  < integer > ,
            "http_code" :  < integer > ,
            "http_msg" :  < string > ,
            "duration" :  < double > ,
            "infected" :  < string > 
        },
        "name" :  < string > ,
        "site2" : {
            "site" :  < string > 
        },
        "type" :  < counter_type > ,
        "favorite" :  < boolean > ,
        "permission" :  < counter_permission > ,
        "mirrors2" : [ {
            "site" :  < string > 
        }, ... ],
        "goals" : [  < goal > , ... ],
        "filters" : [ {
            "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 > 
        }, ... ],
        "operations" : [ {
            "id" :  < int > ,
            "action" :  < operation_type > ,
            "attr" :  < operation_attribute > ,
            "value" :  < string > ,
            "status" :  < operation_status > 
        }, ... ],
        "grants" : [ {
            "user_login" :  < string > ,
            "perm" :  < grant_type > ,
            "created_at" :  < date > ,
            "comment" :  < string > 
        }, ... ],
        "labels" : [ {
            "id" :  < int > ,
            "name" :  < string > 
        }, ... ],
        "webvisor" : {
            "urls" :  < string > ,
            "arch_enabled" :  < boolean > ,
            "arch_type" :  < webvisor_arch_type > ,
            "load_player_type" :  < webvisor_load_player_type > ,
            "wv_version" :  < integer > ,
            "wv_forms" :  < boolean > 
        },
        "code_options" : {
            "async" :  < boolean > ,
            "informer" : {
                "enabled" :  < boolean > ,
                "type" :  < informer_type > ,
                "size" :  < integer > ,
                "indicator" :  < informer_metric > ,
                "color_start" :  < string > ,
                "color_end" :  < string > ,
                "color_text" :  < integer > ,
                "color_arrow" :  < integer > 
            },
            "visor" :  < boolean > ,
            "track_hash" :  < boolean > ,
            "xml_site" :  < boolean > ,
            "clickmap" :  < boolean > ,
            "in_one_line" :  < boolean > ,
            "ecommerce" :  < boolean > 
        },
        "create_time" :  < date > ,
        "time_zone_name" :  < string > ,
        "time_zone_offset" :  < int > 
    }, ... ]
}
Parameters Description
rows Number of counters, satisfying a request, excluding parameters offset and per_page.
counters List of counters.
counters
id Counter ID.
status Counter status.

Possible values:

  • Active — Counter active
  • Deleted — Counter deleted
owner_login Username of counter owner.
code_status Installation status of counter code.

Possible values:

  • CS_ERR_INFECTED — unable to verify (the site on which the counter is installed, or one of its mirrors, is in the list of infected sites).
  • CS_NOT_FOUND — Not installed.
  • CS_ERR_OTHER_HTML_CODE — another counter installed.
  • CS_ERR_CONNECT — unable to verify (connection error).
  • CS_ERR_TIMEOUT — unable to verify (timeout).
  • CS_OK — Correctly installed.
code_status_info Information on counter status.
name Name of counter.
site2 Full site domain.
type Counter type.

Possible values:

  • partner — counter imported from YAN.
  • simple — counter created by user in Yandex.Metrica;
favorite Is counter added to favorites.

Possible values:

  • 0 ― not added (by default);
  • 1 ― added.
permission Access level to counter.

Possible values:

  • view — guest counter with access level “page views only”;
  • edit — guest counter with access level “full access”.
  • own — counter, owned by a user;
mirrors2 List of site mirrors (domains).
goals List of structures with information on counter goals.
filters List of structures with information on counter filters.
operations List of structures with information about counter actions.
grants List of structures with information on access rights to counter.
labels List of structures with information about tags.
webvisor Structure with information about Session Replay settings.
code_options Counter code settings.
create_time Date and time when counter was created.
time_zone_name Time zone for calculation of statistics.
time_zone_offset Current time zone offset from Greenwich, minutes
code_status_info
length Content length in bytes.
found Number of valid Yandex.Metrica codes found.
match Number of valid codes for verified counter found.
http_code HTTP response status code (“200” on success).
http_msg String displaying the HTTP status response code (“OK” on success).
duration Site response time in seconds.
infected Infected site (site on which a counter is installed, or is one of its mirrors).
site2
site Full site domain.
mirrors2
site Full site domain.
filters
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.
operations
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).
grants
user_login

Login of user, which has been granted permission to manage counter.

Parameter contains empty string, if public access is provided to the statistics of the counter (perm = public_stat)

perm Access level.

Possible values:

  • view — page views only;
  • edit — full access.
  • public_stat — public access to statistics;
created_at

Date of granting access in the format YYYY-MM-DD'T'hh:mm:ssZ.

comment

Any comment. 255 characters maximum.

labels
id Tag ID.
name Tag name.
webvisor
urls List of pages for saving.
arch_enabled Saving pages of site.

Possible values:

  • 0 ― disabled (by default);
  • 1 ― enabled.
arch_type Record of page content.

Possible values:

  • load — download from site;
  • html — from browser.
  • none — disabled;
load_player_type Loading pages in the player.

Possible values:

  • proxy — as an anonymous user;
  • on_your_behalf — as you.
wv_version Session Replay version.
wv_forms Запись содержимого полей и форм.

Possible values:

  • 0 - не записывать содержимое полей и форм за исключением тех из них, которые помечены css-классом -metrika-recordkeys;
  • 1 - записывать содержимое полей и форм за исключением тех из них, которые помечены css-классом -metrika-nokeys (по умолчанию).
code_options
async Asynchronous code of counter.

Possible values:

  • 0 ― disabled;
  • 1 ― enabled (by default).
informer Informer settings.
visor Recording and analysis of site user behavior.

Possible values:

  • 0 ― disabled (by default);
  • 1 ― enabled.
ut Stop automatic page indexing.

Possible values:

  • 0 ― disabled (by default);
  • 1 ― enabled.
track_hash Hash tracking in browser address bar. Option applies to AJAX sites.

Possible values:

  • 0 ― disabled (by default);
  • 1 ― enabled.
xml_site For XML-sites. The noscript element should not be used in XML documents.

Possible values:

  • 0 ― disabled (by default);
  • 1 ― enabled.
clickmap Gathering statistics for the click map report.

Possible values:

  • 0 ― disabled;
  • 1 ― enabled (by default).
in_one_line Remove counter code in one string.

Possible values:

  • 0 ― disabled (by default);
  • 1 ― enabled.
ecommerce

Possible values:

  • 0 ― disabled (by default);
  • 1 ― enabled.
informer
enabled Permission for display of informer.

Possible values:

  • 0 ― informer is not displayed (by default);
  • 1 ― informer is displayed.
type Informer type.

Possible values:

  • ext — advanced (by default).
  • simple — simple;
size Size of informer.

Possible values:

  • 1 - size 80х15;
  • 2 - size 80х31;
  • 3 - size 88х31 (by default). Does not affect the value of the indicator field in view of informer of this type.
indicator Parameter which will be displayed on the informer.

Possible values:

  • visits — Sessions;
  • pageviews — pageviews (by default);
  • uniques — users.
color_start Beginning (top) color of informer in the format RRGGBBAA. RR, GG, BB are saturated red, green and blue colors. The level of saturation for every color is assigned a value ranging from 00 to FF. AA is transparency from 00 (transparent) to FF (opaque).
color_end Ending (lower) color of informer in the format RRGGBBAA. The parameter is intended for creating background gradient. Color saturation and transparency are analogously given the parameter color_start.
color_text Text color on informer.

Possible values:

  • 0 ― black (by default);
  • 1 ― white.
color_arrow Arrow color on informer.

Possible values:

  • 0 ― black;
  • 1 ― violet (by default).