Changing a counter

Changes the specified counter.

Request

PUT

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

Path parameters

Name

Description

counterId*

Type: integer<int32>

ID of the counter that you want to get information about.

Query parameters

Name

Description

field

Type: string

One or several additional parameters of a returned object. The names of the additional parameters are specified in any order, separated by commas, without spaces. Example: field=goals,mirrors,grants,filters,operation,counter_flags,measurement_tokens.

Body

application/json
{
    "counter": {
        "id": 0,
        "status": "string",
        "owner_login": "string",
        "activity_status": "string",
        "name": "string",
        "type": "string",
        "favorite": false,
        "permission": "string",
        "goals": [
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "flag": "basket",
                "conditions": [
                    {
                        "type": "string",
                        "url": "string"
                    }
                ]
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "steps": [
                    {
                        "id": 0,
                        "name": "string",
                        "type": "string",
                        "default_price": 0,
                        "goal_source": "string",
                        "is_favorite": false,
                        "flag": "string",
                        "conditions": [
                            {
                                "type": "string",
                                "url": "string"
                            }
                        ]
                    }
                ]
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "depth": 0
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "flag": "basket",
                "conditions": [
                    {
                        "type": "string",
                        "url": "string"
                    }
                ]
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "flag": "basket",
                "conditions": [
                    {
                        "type": "string",
                        "url": "string"
                    }
                ]
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "flag": "basket",
                "conditions": [
                    {
                        "type": "string",
                        "url": "string"
                    }
                ]
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "flag": "basket",
                "conditions": [
                    {
                        "type": "string",
                        "url": "string"
                    }
                ],
                "hide_phone_number": false
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "flag": "basket",
                "conditions": [
                    {
                        "type": "string",
                        "url": "string"
                    }
                ]
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "flag": "basket",
                "conditions": [
                    {
                        "type": "string",
                        "url": "string"
                    }
                ]
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "flag": "basket",
                "conditions": [
                    {
                        "type": "string",
                        "url": "string"
                    }
                ]
            },
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false,
                "duration": 0
            }
        ],
        "filters": [
            {
                "id": 0,
                "attr": "string",
                "type": "string",
                "value": "string",
                "action": "string",
                "status": "string",
                "start_ip": "string",
                "end_ip": "string",
                "with_subdomains": false
            }
        ],
        "operations": [
            {
                "id": 0,
                "action": "string",
                "attr": "string",
                "value": "string",
                "status": "string"
            }
        ],
        "grants": [
            {
                "user_login": "string",
                "user_uid": 0,
                "perm": "string",
                "created_at": "2022-12-29T18:02:01Z",
                "comment": "string",
                "partner_data_access": false
            },
            {
                "user_login": "string",
                "user_uid": 0,
                "perm": "string",
                "created_at": "2022-12-29T18:02:01Z",
                "comment": "string",
                "partner_data_access": false,
                "access_filters": [
                    {
                        "id": 0,
                        "name": "string"
                    }
                ]
            }
        ],
        "labels": [
            {
                "id": 0,
                "name": "string"
            }
        ],
        "webvisor": {
            "urls": "string",
            "arch_enabled": false,
            "arch_type": "string",
            "load_player_type": "string",
            "wv_version": 0,
            "wv_forms": false
        },
        "code_options": {
            "async": false,
            "informer": {
                "enabled": false,
                "type": "string",
                "size": 0,
                "indicator": "string",
                "color_start": "FFFFFFFF.",
                "color_end": "EFEFEFFF",
                "color_text": 0,
                "color_arrow": 0
            },
            "visor": false,
            "track_hash": false,
            "xml_site": false,
            "clickmap": false,
            "in_one_line": false,
            "ecommerce": false,
            "alternative_cdn": false,
            "ytm": false
        },
        "create_time": "2022-12-29T18:02:01Z",
        "time_zone_name": "string",
        "time_zone_offset": 0,
        "source": "string",
        "update_time": "string",
        "delete_time": "string",
        "code": "string",
        "filter_robots": 0,
        "visit_threshold": 1800,
        "publisher_options": {
            "enabled": false,
            "schema": "string",
            "schema_options": [
                "string"
            ]
        },
        "mirrors_remove": 0,
        "goals_remove": 0,
        "filters_remove": 0,
        "operations_remove": 0,
        "grants_remove": 0,
        "site2": {
            "site": "string"
        },
        "gdpr_agreement_accepted": false,
        "mirrors2": [
            {
                "site": "string"
            }
        ],
        "autogoals_enabled": false,
        "counter_flags": {
            "use_in_benchmarks": false,
            "direct_allow_use_goals_without_access": false,
            "collect_first_party_data": false,
            "measurement_enabled": false
        },
        "measurement_tokens": [
            "string"
        ]
    }
}

Name

Description

counter*

Type: CounterEdit

Counter.

CounterEdit

Counter.

Name

Description

activity_status

Type: string

Counter traffic. Possible values:

  • low: Low traffic.
  • high: High traffic.

autogoals_enabled

Type: boolean

Enabling automatic goals. Possible values:

  • true: The option is enabled.
  • false: The option is disabled.

code

Type: string

HTML code of the counter.

code_options

Type: CodeOptionsE

Counter code settings.

counter_flags

Type: CounterFlags

Data security and usage.

create_time

Type: string<date-time>

Date and time when the counter was created.

delete_time

Type: string

Time of counter deletion.

favorite

Type: boolean

Whether the counter is added to favorites:

  • 0: Not added (default).
  • 1: Added.

filter_robots

Type: integer<int32>

Filtering of robots:

  • 1: Filter robots by strict rules only (default).
  • 2: Filter robots by strict rules and by behavior.

Min value: 1

Max value: 2

filters

Type: FilterE[]

List of structures with information on counter filters.

filters_remove

Type: integer<int32>

Whether to remove filters:

  • 0: Do not remove filters (default).
  • 1: Ignore the input filters parameter (if specified), and also remove any previously set filters for the counter.

gdpr_agreement_accepted

Type: boolean

Acceptance of the Yandex Metrica Data Processing Agreement.

  • 0: Agreement not accepted (default).
  • 1: Agreement accepted.

goals

Type: (ActionGoal or CompositeGoal or DepthGoal or EmailGoal or FileGoal or MessengerGoal or PaymentSystemGoal or PhoneGoal or SiteSearchGoal or SocialNetworkGoal or UrlGoal or VisitDurationGoal)[]

List of structures with information on counter goals.

goals_remove

Type: integer<int32>

Whether to remove goals:

  • 0: Do not remove goals (default).
  • 1: Ignore the input goals parameter (if specified), and also remove any previously set goals for the counter.

grants

Type: (CounterGrantE or AccessFiltersGrantE)[]

grants_remove

Type: integer<int32>

Whether to remove access settings:

  • 0: Do not remove access settings (default).
  • 1: Ignore the input grants parameter (if specified), and also remove any previously set access settings for the counter.

id

Type: integer<int32>

Counter ID.

labels

Type: Label[]

List of structures with information on labels.
Label.

measurement_tokens

Type: string[]

List of active tokens.

mirrors2

Type: CounterMirrorE[]

List of site mirrors (domains).

mirrors_remove

Type: integer<int32>

Whether to remove mirrors:

  • 0: Do not remove mirrors (default).
  • 1: Ignore the input mirrors parameter (if specified), and also remove any previously set site mirrors for the counter.

name

Type: string

Counter name.

Min length: 0

Max length: 255

operations

Type: OperationE[]

List of structures with information on counter actions.

operations_remove

Type: integer<int32>

Whether to remove actions:

  • 0: Do not remove actions (default).
  • 1: Ignore the input operations parameter (if specified) and also remove any previously set actions for the counter.

owner_login

Type: string

Login of the counter owner.

permission

Type: string

Level of access to the counter:

  • own: Counter that belongs to the user.
  • view: Counter with guest access level (view only).
  • edit: Guest counter with full access.
  • analyst: Guest counter with the analytics access level.
  • view_access_filter: Guest counter with access filter view only access.
  • analyst_access_filter: Guest counter with access filter data analytics access.

publisher_options

Type: PublisherOptions

Structure with information on content analytics settings.

site2

Type: CounterMirrorE

List of site mirrors (domains).

source

Type: string

Counter type. Possible values:

  • turbodirect: Turbo Direct.
  • marketplace_direct: Yandex Direct marketplaces.
  • sprav: Yandex Business.
  • partner: Yandex Advertising Network.
  • system: System.
  • market: Market.
  • eda: Yandex Eats.
  • dzen: Zen.
  • geoadv: Advertising account.
  • games: Yandex Games.

status

Type: string

Counter status. Possible values:

  • Active: Counter active.
  • Deleted: Counter deleted.

time_zone_name

Type: string

Time zone for calculating statistics.

time_zone_offset

Type: integer<int32>

Current time zone offset from Greenwich, minutes.

type

Type: string

Counter type. Possible values:

  • simple: Counter created by the user in Yandex Metrica.
  • partner: Counter imported from the Yandex Advertising Network.

update_time

Type: string

Time of the last counter update.

visit_threshold

Type: integer<int32>

Session timeout in seconds.

Default: 1800

Min value: 1800

Max value: 21600

webvisor

Type: WebvisorOptions

Structure with information on Session Replay settings.

CodeOptionsE

Counter code settings.

Name

Description

alternative_cdn

Type: boolean

Allows you to correctly register sessions from regions in which access to Yandex resources is restricted. It might take longer to load the counter code when using this option:

  • 0: Disabled (default).
  • 1: Enabled.

async

Type: boolean

Asynchronous counter code:

  • 0: Disabled.
  • 1: Enabled (default).

clickmap

Type: boolean

Gathering statistics for the Click Map report:

  • 0: Disabled (default).
  • 1: Enabled.

ecommerce

Type: boolean

Collecting E-commerce data:

  • 0: Disabled (default).
  • 1: Enabled.

in_one_line

Type: boolean

Print a counter code as a single string:

  • 0: Disabled (default).
  • 1: Enabled.

informer

Type: InformerOptionsE

Informer settings.

track_hash

Type: boolean

Hash tracking in the browser address bar. The option applies to AJAX sites:

  • 0: Disabled (default).
  • 1: Enabled.

visor

Type: boolean

Record and analysis of site user behavior:

  • 0: Disabled (default).
  • 1: Enabled.

xml_site

Type: boolean

For XML sites. The "noscript" element cannot be used in XML documents:

  • 0: Disabled (default).
  • 1: Enabled.

ytm

Type: boolean

Whether the counter management system is used. Possible values:

  • 0: Not used.
  • 1: Used.

CounterFlags

Data security and usage.

Name

Description

collect_first_party_data

Type: boolean

Use additional tracking settings. This option allows Yandex Metrica to use the contact information entered by the user on the site to enhance advertising algorithms and more accurately analyze user behavior. This helps you increase the effectiveness of ad campaigns and learn more about user behavior, even if they use browsers that limit cross-site cookies (third-party cookies), such as Safari and Mozilla Firefox.

direct_allow_use_goals_without_access

Type: boolean

Allow optimizing campaigns for goals without access to the counter. If your ad campaigns are managed in Yandex Direct by someone other than you, such as an agency or a setup expert, you can grant permissions for using existing goals in Yandex Metrica. If the counter was created recently, the option is enabled by default. For more information, see the Help section.

measurement_enabled

Type: boolean

Enable the Measurement Protocol option. The Measurement Protocol is an API for sending data about user interactions directly to Yandex Metrica servers via HTTP requests.

use_in_benchmarks

Type: boolean

Get access to market reports. The option allows Yandex Metrica to use aggregated anonymized counter data to build market analytics reports. The collected data helps you understand the state of your business relative to the market. If the counter was created recently, the option is enabled by default.

FilterE

List of structures with information on counter filters.

Name

Description

action*

Type: string

Filter type:

  • exclude: Exclude traffic.
  • include: Leave only traffic.

attr*

Type: string

Data type the filter is applied to:

  • title: Page title.
  • client_ip: IP address.
  • url: Page URL.
  • referer: Referrer.
  • uniq_id: Special filter attribute Don't count my sessions.

status*

Type: string

Filter status:

  • active: Filter is used.
  • disabled: Filter disabled (without deletion).

type*

Type: string

Filter type or action for filter:

  • equal: Equal to.
  • start: Starts with.
  • contain: Contains.
  • interval: In the interval, used only with the "IP address" data type (attr = client_ip).
  • me: My sessions, used only with the attr = uniq_id data type.
  • only_mirrors: Only the site and its mirrors, used only for the "Page URL" data type (attr = url) and the Leave only traffic data type (action = include), and provided that mirrors are specified for the counter.
  • regexp: Regular expression.

end_ip

Type: string

The last IP address in the range.

id

Type: integer<int32>

Filter ID. Specify this parameter when changing a counter filter.

start_ip

Type: string

The first IP address in the range.

value

Type: string

Filter value.

with_subdomains

Type: boolean

Filter by subdomains.

ActionGoal

JavaScript event.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

conditions

Type: GoalCondition[]

List of structures with the goal conditions.

default_price

Type: number<double>

Default goal cost.

flag

Type: string

Goal type for Yandex Market clients:

  • basket: Shopping cart, shopping cart page.
  • order: Order, order confirmation page.

Enum: basket, order, ``

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

CompositeGoal

Multi-step goal. Used for grouping and setting the order of usual goals. Page view and JavaScript event goals can be steps of a multi-step goal. A step is considered completed if all the previous steps were completed and all the current step's conditions were met.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

steps*

Type: ConditionalGoal[]

List of steps in a multi-step goal.

Min items: 0

Max items: 5

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

default_price

Type: number<double>

Default goal cost.

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

DepthGoal

Page depth. The goal is considered achieved if the user viewed the specified number of site pages.

Name

Description

depth*

Type: integer<int64>

Number of pages viewed by the user.

Min value: 2

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

default_price

Type: number<double>

Default goal cost.

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

EmailGoal

Clicks or taps on an email address.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

conditions

Type: GoalCondition[]

List of structures with the goal conditions.

default_price

Type: number<double>

Default goal cost.

flag

Type: string

Goal type for Yandex Market clients:

  • basket: Shopping cart, shopping cart page.
  • order: Order, order confirmation page.

Enum: basket, order, ``

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

FileGoal

File download. The goal is considered achieved if the user downloaded any file or a specific file.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

conditions

Type: GoalCondition[]

List of structures with the goal conditions.

default_price

Type: number<double>

Default goal cost.

flag

Type: string

Goal type for Yandex Market clients:

  • basket: Shopping cart, shopping cart page.
  • order: Order, order confirmation page.

Enum: basket, order, ``

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

MessengerGoal

Click-through to a messenger. The goal will be achieved once the user clicks the link to the messenger.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

conditions

Type: GoalCondition[]

List of structures with the goal conditions.

default_price

Type: number<double>

Default goal cost.

flag

Type: string

Goal type for Yandex Market clients:

  • basket: Shopping cart, shopping cart page.
  • order: Order, order confirmation page.

Enum: basket, order, ``

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

PaymentSystemGoal

Payment systems. The goal is considered achieved if the user makes a payment via a payment system.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

default_price

Type: number<double>

Default goal cost.

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

PhoneGoal

Clicks or taps on a phone number.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

conditions

Type: GoalCondition[]

List of structures with the goal conditions.

default_price

Type: number<double>

Default goal cost.

flag

Type: string

Goal type for Yandex Market clients:

  • basket: Shopping cart, shopping cart page.
  • order: Order, order confirmation page.

Enum: basket, order, ``

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

hide_phone_number

Type: boolean

Hide the phone number on desktops.

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

SiteSearchGoal

Site search. The goal will be achieved when performing a site search if there is at least one match in the URL specified in the GET parameters.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

conditions

Type: GoalCondition[]

List of structures with the goal conditions.

default_price

Type: number<double>

Default goal cost.

flag

Type: string

Goal type for Yandex Market clients:

  • basket: Shopping cart, shopping cart page.
  • order: Order, order confirmation page.

Enum: basket, order, ``

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

SocialNetworkGoal

Click-through to social network. The goal will be achieved once the user clicks the link to the social network.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

conditions

Type: GoalCondition[]

List of structures with the goal conditions.

default_price

Type: number<double>

Default goal cost.

flag

Type: string

Goal type for Yandex Market clients:

  • basket: Shopping cart, shopping cart page.
  • order: Order, order confirmation page.

Enum: basket, order, ``

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

UrlGoal

Pageviews. Achieved when at least one condition is met.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

conditions

Type: GoalCondition[]

List of structures with the goal conditions.

default_price

Type: number<double>

Default goal cost.

flag

Type: string

Goal type for Yandex Market clients:

  • basket: Shopping cart, shopping cart page.
  • order: Order, order confirmation page.

Enum: basket, order, ``

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

VisitDurationGoal

Session duration. The goal will be achieved if the session duration exceeds the specified one.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

default_price

Type: number<double>

Default goal cost.

duration

Type: integer<int32>

Session duration in seconds.

Min value: 1

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

CounterGrantE

List of structures with information on access rights to the counter.

Name

Description

perm*

Type: string

Access level:

  • public_stat: Public access to statistics.
  • view: Read only.
  • edit: Full access.
  • analyst: Analyst.
  • analyst_access_filter: Data analyst with filter-based access.

comment

Type: string

Arbitrary comment. The maximum number of characters is 255.

Min length: 0

Max length: 255

created_at

Type: string<date-time>

Date when the permission was granted in YYYY-MM-DD'T'hh:mm:ssZ format.

partner_data_access

Type: boolean

Access to the Monetization report group. The user can view reports and add dimensions and metrics from the Monetization group to other reports. If the user has edit rights, reports from the Monetization group are already available to them. Possible values:

  • true: Access granted.
  • false: Access denied.

user_login

Type: string

Login of a user with counter management rights. This parameter contains an empty string if counter statistics are in public access (perm = public_stat).

user_uid

Type: integer<int64>

uid (Yandex ID) of a user with counter management rights. Parameter is 0 if counter statistics are in public access (perm = public_stat).

Note

Optional request parameter.

AccessFiltersGrantE

Name

Description

access_filters*

Type: AccessFiltersShortE[]

List of access filters granted to the user.

Min items: 1

Max items: 1

perm*

Type: string

Access level:

  • public_stat: Public access to statistics.
  • view: Read only.
  • edit: Full access.
  • analyst: Analyst.
  • analyst_access_filter: Data analyst with filter-based access.

comment

Type: string

Arbitrary comment. The maximum number of characters is 255.

Min length: 0

Max length: 255

created_at

Type: string<date-time>

Date when the permission was granted in YYYY-MM-DD'T'hh:mm:ssZ format.

partner_data_access

Type: boolean

Access to the Monetization report group. The user can view reports and add dimensions and metrics from the Monetization group to other reports. If the user has edit rights, reports from the Monetization group are already available to them. Possible values:

  • true: Access granted.
  • false: Access denied.

user_login

Type: string

Login of a user with counter management rights. This parameter contains an empty string if counter statistics are in public access (perm = public_stat).

user_uid

Type: integer<int64>

uid (Yandex ID) of a user with counter management rights. Parameter is 0 if counter statistics are in public access (perm = public_stat).

Note

Optional request parameter.

Label

Label.

Name

Description

id

Type: integer<int32>

Label ID.

name

Type: string

Label name.

Min length: 0

Max length: 255

CounterMirrorE

List of site mirrors (domains).

Name

Description

site*

Type: string

Full site domain.

Min length: 0

Max length: 255

OperationE

List of structures with information on counter actions.

Name

Description

action*

Type: string

Action type:

  • cut_fragment: Remove anchor from URL.
  • cut_parameter: Remove specific parameter from URL.
  • cut_all_parameters: Cut all parameters from URL.
  • merge_https_and_http: Replace https:// with http://.
  • to_lower: Convert to lower case.
  • replace_domain: Replace domain.

attr*

Type: string

Field for filtering:

  • referer: Referrer.
  • url: Page URL.

status*

Type: string

Action status:

  • active: Action is used.
  • disabled: Action is disabled (without deletion).

id

Type: integer<int32>

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

value

Type: string

Value for replacement.

PublisherOptions

Structure with information on content analytics settings.

Name

Description

enabled

Type: boolean

Collection of content analytics data. To start collecting statistics, add the markup to your site.

  • 0: Disabled (default).
  • 1: Enabled.

schema

Type: string

Available site markup options. Possible values:

  • microdata.
  • json_ld.
  • opengraph.

schema_options

Type: string[]

Available site markup options. Possible values:

  • microdata.
  • json_ld.
  • opengraph.

WebvisorOptions

Structure with information on Session Replay settings.

Name

Description

arch_enabled

Type: boolean

Saving site pages:

  • 0: Disabled (default).
  • 1: Enabled.

arch_type

Type: string

Recording page content:

  • none: Disabled.
  • load: Download from site.
  • html: From browser.

load_player_type

Type: string

Loading pages in the player:

  • proxy: As an anonymous user.
  • on_your_behalf: As you.

urls

Type: string

List of pages for saving.

Min length: 0

Max length: 2000

wv_forms

Type: boolean

Records the content of fields and forms:

  • 0: Don't record the content of fields and forms, except the ones marked with the -metrika-recordkeys CSS class.
  • 1: Record the content of fields and forms, except the ones marked with the -metrika-nokeys CSS class (default).

wv_version

Type: integer<int32>

Session Replay version.

InformerOptionsE

Informer settings.

Name

Description

color_arrow

Type: integer<int32>

Color of the arrow in the informer:

  • 0: Black.
  • 1: Purple (default).

Min value: 0

Max value: 1

color_end

Type: string

End (bottom) color of the informer in RRGGBBAA format. The parameter is intended for creating background gradient. Color saturation and transparency are set the same way as with the "color_start" parameter.

Default: EFEFEFFF

Pattern: [0-9A-F]{8}

color_start

Type: string

Beginning (top) color of the informer in RRGGBBAA format. RR, GG, BB are saturated red, green, and blue colors. The level of saturation for every color is set with a value ranging from 00 to FF. AA: transparency, from 00 (transparent) to FF (opaque).

Default: FFFFFFFF.

Pattern: [0-9A-F]{8}

color_text

Type: integer<int32>

Color of the text in the informer:

  • 0: Black (default).
  • 1: White.

Min value: 0

Max value: 1

enabled

Type: boolean

Permission to display the informer:

  • 0: Informer is not displayed (default).
  • 1: Informer is displayed.

indicator

Type: string

Parameter to be displayed on the informer:

  • pageviews: Pageviews (default).
  • visits: Sessions.
  • uniques: Users.

size

Type: integer<int32>

Informer size:

  • 1: 80×15
  • 2: 80х31
  • 3: 88×31 (default). The value in the indicator field doesn't affect the layout of this type of informer.

Min value: 1

Max value: 3

type

Type: string

Informer type:

  • simple: Simple.
  • ext: Extended (default).

GoalCondition

List of structures with the goal conditions.

Name

Description

type*

Type: string

Condition type:

  • contain: Contains.
  • exact: Matches exactly.
  • start: Starts with.
  • regexp: Matches a regular expression.
  • action: Special type of condition for the "JavaScript event" goals.
  • messenger: Special type of conditions for "form" goals, path in the DOM tree.
  • all_files: Attribute for "Open messenger" goals.
  • file: Downloading a specific file for "File downloads" goals.
  • search: Attribute for "Site search" goals.
  • all_social: Special type of condition for social goals (all social networks).
  • social: Special type of condition for social goals (a specific social network).
  • regexp_action: JS event matches a regular expression (used exclusively in a step of a multi-step goal).
  • contain_action: JS event contains (used exclusively in a step of a multi-step goal).

url

Type: string

The value depends on the goal type:

  • Page view. URL to page or page section for the condition.
  • Click on email or Click on phone number. Email or phone number specified in the links on the site. Learn more about tracking clicks on email addresses or phone numbers.
  • Open messenger. Name of the messenger retrieved by the GET management/v1/messengers method, or the all_messengers value.
  • Site search. GET parameter used for searching on the site. Yandex Metrica automatically recognizes the q, text, query, or search parameters. If the site uses a different parameter, specify it in the request.
  • File download. File name, for example, example.pdf. The value can be empty if you need to track all the files downloaded on the site.
  • Click-through to social network. Name of the social network obtained via the GET management/v1/social_networks method, or the all_social value.

ConditionalGoal

List of steps in a multi-step goal.

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

conditions

Type: GoalCondition[]

List of structures with the goal conditions.

default_price

Type: number<double>

Default goal cost.

flag

Type: string

Goal type for Yandex Market clients:

  • basket: Shopping cart, shopping cart page.
  • order: Order, order confirmation page.

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.

AccessFiltersShortE

List of access filters granted to the user.

Name

Description

id

Type: integer<int32>

Access filter ID.

name

Type: string

Access filter name.

Responses

200 OK

OK

Body

application/json
{
    "counter": {
        "id": 0,
        "status": "string",
        "owner_login": "string",
        "activity_status": "string",
        "name": "string",
        "type": "string",
        "favorite": false,
        "permission": "string",
        "goals": [
            {
                "id": 0,
                "name": "string",
                "type": "string",
                "default_price": 0,
                "goal_source": "string",
                "is_favorite": false
            }
        ],
        "filters": [
            {
                "id": 0,
                "attr": "string",
                "type": "string",
                "value": "string",
                "action": "string",
                "status": "string",
                "start_ip": "string",
                "end_ip": "string",
                "with_subdomains": false
            }
        ],
        "operations": [
            {
                "id": 0,
                "action": "string",
                "attr": "string",
                "value": "string",
                "status": "string"
            }
        ],
        "grants": [
            {
                "user_login": "string",
                "user_uid": 0,
                "perm": "string",
                "created_at": "2022-12-29T18:02:01Z",
                "comment": "string",
                "partner_data_access": false
            }
        ],
        "labels": [
            {
                "id": 0,
                "name": "string"
            }
        ],
        "webvisor": {
            "urls": "string",
            "arch_enabled": false,
            "arch_type": "string",
            "load_player_type": "string",
            "wv_version": 0,
            "wv_forms": false
        },
        "code_options": {
            "async": false,
            "informer": {
                "enabled": false,
                "type": "string",
                "size": 0,
                "indicator": "string",
                "color_start": "FFFFFFFF.",
                "color_end": "EFEFEFFF",
                "color_text": 0,
                "color_arrow": 0
            },
            "visor": false,
            "track_hash": false,
            "xml_site": false,
            "clickmap": false,
            "in_one_line": false,
            "ecommerce": false,
            "alternative_cdn": false,
            "ytm": false
        },
        "create_time": "2022-12-29T18:02:01Z",
        "time_zone_name": "string",
        "time_zone_offset": 0,
        "source": "string",
        "update_time": "string",
        "delete_time": "string",
        "code": "string",
        "filter_robots": 0,
        "visit_threshold": 1800,
        "publisher_options": {
            "enabled": false,
            "schema": "string",
            "schema_options": [
                "string"
            ]
        },
        "site2": {
            "site": "string"
        },
        "gdpr_agreement_accepted": false,
        "mirrors2": [
            {
                "site": "string"
            }
        ],
        "autogoals_enabled": false,
        "counter_flags": {
            "use_in_benchmarks": false,
            "direct_allow_use_goals_without_access": false,
            "collect_first_party_data": false,
            "measurement_enabled": false
        },
        "measurement_tokens": [
            "string"
        ]
    }
}

Name

Description

counter*

Type: CounterFull

Counter.

CounterFull

Counter.

Name

Description

activity_status

Type: string

Counter traffic. Possible values:

  • low: Low traffic.
  • high: High traffic.

autogoals_enabled

Type: boolean

Enabling automatic goals. Possible values:

  • true: The option is enabled.
  • false: The option is disabled.

code

Type: string

HTML code of the counter.

code_options

Type: CodeOptionsE

Counter code settings.

counter_flags

Type: CounterFlags

Data security and usage.

create_time

Type: string<date-time>

Date and time when the counter was created.

delete_time

Type: string

Time of counter deletion.

favorite

Type: boolean

Whether the counter is added to favorites:

  • 0: Not added (default).
  • 1: Added.

filter_robots

Type: integer<int32>

Filtering of robots:

  • 1: Filter robots by strict rules only (default).
  • 2: Filter robots by strict rules and by behavior.

Min value: 1

Max value: 2

filters

Type: FilterE[]

List of structures with information on counter filters.

gdpr_agreement_accepted

Type: boolean

Acceptance of the Yandex Metrica Data Processing Agreement.

  • 0: Agreement not accepted (default).
  • 1: Agreement accepted.

goals

Type: GoalE[]

List of structures with information on counter goals.

grants

Type: CounterGrantE[]

List of structures with information on access rights to the counter.

id

Type: integer<int32>

Counter ID.

labels

Type: Label[]

List of structures with information on labels.
Label.

measurement_tokens

Type: string[]

List of active tokens.

mirrors2

Type: CounterMirrorE[]

List of site mirrors (domains).

name

Type: string

Counter name.

Min length: 0

Max length: 255

operations

Type: OperationE[]

List of structures with information on counter actions.

owner_login

Type: string

Login of the counter owner.

permission

Type: string

Level of access to the counter:

  • own: Counter that belongs to the user.
  • view: Counter with guest access level (view only).
  • edit: Guest counter with full access.
  • analyst: Guest counter with the analytics access level.
  • view_access_filter: Guest counter with access filter view only access.
  • analyst_access_filter: Guest counter with access filter data analytics access.

publisher_options

Type: PublisherOptions

Structure with information on content analytics settings.

site2

Type: CounterMirrorE

List of site mirrors (domains).

source

Type: string

Counter type. Possible values:

  • turbodirect: Turbo Direct.
  • marketplace_direct: Yandex Direct marketplaces.
  • sprav: Yandex Business.
  • partner: Yandex Advertising Network.
  • system: System.
  • market: Market.
  • eda: Yandex Eats.
  • dzen: Zen.
  • geoadv: Advertising account.
  • games: Yandex Games.

status

Type: string

Counter status. Possible values:

  • Active: Counter active.
  • Deleted: Counter deleted.

time_zone_name

Type: string

Time zone for calculating statistics.

time_zone_offset

Type: integer<int32>

Current time zone offset from Greenwich, minutes.

type

Type: string

Counter type. Possible values:

  • simple: Counter created by the user in Yandex Metrica.
  • partner: Counter imported from the Yandex Advertising Network.

update_time

Type: string

Time of the last counter update.

visit_threshold

Type: integer<int32>

Session timeout in seconds.

Default: 1800

Min value: 1800

Max value: 21600

webvisor

Type: WebvisorOptions

Structure with information on Session Replay settings.

GoalE

Name

Description

name*

Type: string

Goal name.

Min length: 0

Max length: 255

type*

Type: string

Goal type:

  • url: Pageviews.
  • number: Number of views.
  • step: Multi-step goal.
  • action: JavaScript event.
  • phone: Click on phone number.
  • email: Click on email.
  • payment_system: Payment system.
  • messenger: Click-through to a messenger.
  • file: File download.
  • search: Site search.
  • social: Click-through to social media accounts.
  • visit_duration: Session duration.

default_price

Type: number<double>

Default goal cost.

goal_source

Type: string

Indicates how the goal was created:

  • user: The goal was created by a Yandex Metrica user.
  • auto: The goal was created automatically. Such goals include automatic goals and the Call goal (created when passing call data).

id

Type: integer<int64>

ID of the goal. Specify this parameter when changing and deleting a counter goal.

is_favorite

Type: boolean

Whether the goal is favorite:

  • 0: False (default).
  • 1: True.