Creating a goal
Creates a counter goal.
Request
POST
https://api-metrica.yandex.net/management/v1/counter/{counterId}/goals
Path parameters
Name |
Description |
counterId* |
Type: integer<int32> ID of the counter that you want to create a goal for. |
Body
application/json
{
"goal": {
"id": 0,
"name": "string",
"type": "string",
"default_price": 0,
"goal_source": "string",
"is_favorite": false,
"flag": "basket",
"conditions": [
{
"type": "string",
"url": "string"
}
]
}
}
Name |
Description |
goal* |
Type: ActionGoal or CompositeGoal or DepthGoal or EmailGoal or FileGoal or MessengerGoal or PaymentSystemGoal or PhoneGoal or SiteSearchGoal or SocialNetworkGoal or UrlGoal or VisitDurationGoal |
ActionGoal
JavaScript event.
Name |
Description |
name* |
Type: string Goal name. Min length: Max length: |
type* |
Type: string Goal type:
|
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:
Enum: |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
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: Max length: |
steps* |
Type: ConditionalGoal[] List of steps in a multi-step goal. Min items: Max items: |
type* |
Type: string Goal type:
|
default_price |
Type: number<double> Default goal cost. |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
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: |
name* |
Type: string Goal name. Min length: Max length: |
type* |
Type: string Goal type:
|
default_price |
Type: number<double> Default goal cost. |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
EmailGoal
Clicks or taps on an email address.
Name |
Description |
name* |
Type: string Goal name. Min length: Max length: |
type* |
Type: string Goal type:
|
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:
Enum: |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
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: Max length: |
type* |
Type: string Goal type:
|
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:
Enum: |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
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: Max length: |
type* |
Type: string Goal type:
|
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:
Enum: |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
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: Max length: |
type* |
Type: string Goal type:
|
default_price |
Type: number<double> Default goal cost. |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
PhoneGoal
Clicks or taps on a phone number.
Name |
Description |
name* |
Type: string Goal name. Min length: Max length: |
type* |
Type: string Goal type:
|
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:
Enum: |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
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: Max length: |
type* |
Type: string Goal type:
|
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:
Enum: |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
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: Max length: |
type* |
Type: string Goal type:
|
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:
Enum: |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
UrlGoal
Pageviews. Achieved when at least one condition is met.
Name |
Description |
name* |
Type: string Goal name. Min length: Max length: |
type* |
Type: string Goal type:
|
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:
Enum: |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
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: Max length: |
type* |
Type: string Goal type:
|
default_price |
Type: number<double> Default goal cost. |
duration |
Type: integer<int32> Session duration in seconds. Min value: |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
GoalE
Name |
Description |
name* |
Type: string Goal name. Min length: Max length: |
type* |
Type: string Goal type:
|
default_price |
Type: number<double> Default goal cost. |
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
GoalCondition
List of structures with the goal conditions.
Name |
Description |
type* |
Type: string Condition type:
|
url |
Type: string The value depends on the goal type:
|
ConditionalGoal
List of steps in a multi-step goal.
Name |
Description |
name* |
Type: string Goal name. Min length: Max length: |
type* |
Type: string Goal type:
|
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:
|
goal_source |
Type: string Indicates how the goal was created:
|
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:
|
Responses
200 OK
OK
Body
application/json
{
"goal": {
"id": 0,
"name": "string",
"type": "string",
"default_price": 0,
"goal_source": "string",
"is_favorite": false
}
}
Name |
Description |
goal* |
Type: GoalE |
No longer supported, please use an alternative and newer version.