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 > 
    }, ... ]
}
ParametersDescription
rowsNumber of counters, satisfying a request, excluding parameters offset and per_page.
countersList of counters.
counters
idCounter ID.
statusCounter status.

Possible values:

  • Active — Counter active
  • Deleted — Counter deleted
owner_loginUsername of counter owner.
code_statusInstallation 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_infoInformation on counter status.
nameName of counter.
site2Full site domain.
typeCounter type.

Possible values:

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

Possible values:

  • 0 ― not added (by default);
  • 1 ― added.
permissionAccess 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;
mirrors2List of site mirrors (domains).
goalsList of structures with information on counter goals.
filtersList of structures with information on counter filters.
operationsList of structures with information about counter actions.
grantsList of structures with information on access rights to counter.
labelsList of structures with information about tags.
webvisorStructure with information about Session Replay settings.
code_optionsCounter code settings.
create_timeDate and time when counter was created.
time_zone_nameTime zone for calculation of statistics.
time_zone_offsetCurrent time zone offset from Greenwich, minutes
code_status_info
lengthContent length in bytes.
foundNumber of valid Yandex.Metrica codes found.
matchNumber of valid codes for verified counter found.
http_codeHTTP response status code (“200” on success).
http_msgString displaying the HTTP status response code (“OK” on success).
durationSite response time in seconds.
infectedInfected site (site on which a counter is installed, or is one of its mirrors).
site2
siteFull site domain.
mirrors2
siteFull site domain.
filters
id

Filter ID. Specify this parameter when changing a counter filter

attrType 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;
typeFilter 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.
valueFilter value.
actionFilter type.

Possible values:

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

Possible values:

  • active — filter is used;
  • disabled — filter disabled (without deletion).
start_ipFirst IP-address range.
end_ipLast IP-address of range.
with_subdomainsFilter by subdomains.
operations
id

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

actionAction 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;
attrField for filtration.

Possible values:

  • referer — referrer;
  • url — page URL.
valueValue for replacement.
statusAction 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)

permAccess 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
idTag ID.
nameTag name.
webvisor
urlsList of pages for saving.
arch_enabledSaving pages of site.

Possible values:

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

Possible values:

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

Possible values:

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

Possible values:

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

Possible values:

  • 0 ― disabled;
  • 1 ― enabled (by default).
informerInformer settings.
visorRecording and analysis of site user behavior.

Possible values:

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

Possible values:

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

Possible values:

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

Possible values:

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

Possible values:

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

Possible values:

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

Possible values:

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

Possible values:

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

Possible values:

  • ext — advanced (by default).
  • simple — simple;
sizeSize 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.
indicatorParameter which will be displayed on the informer.

Possible values:

  • visits — Sessions;
  • pageviews — pageviews (by default);
  • uniques — users.
color_startBeginning (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_endEnding (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_textText color on informer.

Possible values:

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

Possible values:

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