List of goals

Returns information about counter goals.

Request

GET

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

Path parameters

Name

Description

counterId*

Type: integer<int32>

ID of the counter for which you want to get a list of goals.
Example: 2215573

Query parameters

Name

Description

callback

Type: string

Callback function that processes the API response.

useDeleted

Type: boolean

Information on deleted goals.

Default: false

Responses

200 OK

OK

Body

application/json
{
    "goals": [
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "conditions": [
                {
                    "type": "string",
                    "url": "string"
                }
            ],
            "flag": "basket"
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "steps": [
                {
                    "id": 0,
                    "name": "string",
                    "type": "string",
                    "default_price": 0,
                    "goal_source": "string",
                    "is_favorite": false,
                    "status": "string",
                    "conditions": [
                        {
                            "type": "string",
                            "url": "string"
                        }
                    ],
                    "flag": "string"
                }
            ]
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "depth": 0
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "conditions": [
                {
                    "type": "string",
                    "url": "string"
                }
            ],
            "flag": "basket"
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "conditions": [
                {
                    "type": "string",
                    "url": "string"
                }
            ],
            "flag": "basket"
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "conditions": [
                {
                    "type": "string",
                    "url": "string"
                }
            ],
            "flag": "basket"
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string"
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "conditions": [
                {
                    "type": "string",
                    "url": "string"
                }
            ],
            "flag": "basket",
            "hide_phone_number": false
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "conditions": [
                {
                    "type": "string",
                    "url": "string"
                }
            ],
            "flag": "basket"
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "conditions": [
                {
                    "type": "string",
                    "url": "string"
                }
            ],
            "flag": "basket"
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "conditions": [
                {
                    "type": "string",
                    "url": "string"
                }
            ],
            "flag": "basket"
        },
        {
            "id": 0,
            "name": "string",
            "type": "string",
            "default_price": 0,
            "goal_source": "string",
            "is_favorite": false,
            "status": "string",
            "duration": 0
        }
    ]
}

Name

Description

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.

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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

MessengerGoal

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

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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

PhoneGoal

Clicks or taps on the 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 a phone number.
  • email: Click on an email address.
  • 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 desktop devices.

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.

status

Type: string

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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

SocialNetworkGoal

Click-through to a 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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

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 conditions 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 condition type for social goals (all social networks).
  • social: Special condition type 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 only in a step of a multi-step goal).

url

Type: string

The value depends on the goal type:

  • Page view. The URL of the page or a section of the page 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 a messaging app. Name of the messaging app retrieved using the GET management/v1/messengers method, or the all_messengers value.
  • Site search. The GET parameter that is used for site search. Yandex Metrica automatically recognizes the q, text, query, and search parameters. If the site uses a different parameter, specify it in the request.
  • File download. File name. For example, example.pdf. You can leave this blank if you want to track all file downloads on the site.
  • Click-through to a social network. The name of the social network, obtained using 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 a phone number.
  • email: Click on an email address.
  • 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.

status

Type: string

No longer supported, please use an alternative and newer version.