Goals

Goals let you track specific user actions, such as:

Goals created in Yandex.Metrica can be used in Yandex.Direct and Yandex.Audience.

Creating a goal

To create a goal, follow these steps:

  1. Click Add goal.
  2. In the Name box, enter a name for the goal to create.
  3. If you need to create a retargeting goal, select the Retargeting option. If this option is not selected, a conversion goal will be created.
  4. Go to the appropriate tab:

    Page depth

    This type of goal lets you set the specific number of pages viewed by the site user. To set a goal, specify an integer greater than 1 in Pageviews.

    Page view

    This type of goal lets you set a specific page or pages on the site that you are interested in visits to.

    You can enter the full URL or part of a URL, or use a regular expression.

    Possible ways to set conditions:

    • “url: matches”. The full URL of the target page is specified.
    • “url: contains”. Part of a URL is specified. This option is usually used if there are multiple target pages and they can be combined with a single condition. Specify as much of the URL as possible so the goal is completed only on the desired pages.
    • “url: begins with...”. Only the first part of the URL is specified. Use this type of condition if you need to track pageviews in subdirectories.

      For example, if the set condition is “example.com/abc/”, the goal will be completed on example.com/abc/1, example.com/abc/2, and example.com/abc/1/2/3.
    • “url: regular expression”. Used for tracking URLs that match a custom pattern.

    You can use multiple conditions (up to 10) for setting page URLs. These conditions are combined using the OR logical operator. So the goal is considered completed if at least one of the set conditions is met.

    You can also use this type of goal to track external link traffic (including file downloads). Let's look at an example:

    The goal “url contains: *order*” is set. The counter owner's site has the page http://example.com/order/, as well as a link to the external resource http://external-example.com/order?id. When registering a goal completion, Yandex.Metrica counts click through both from the link on the owner's site and the external link. Due to the external traffic, the number of goal completions will be more than the total number of page views containing order in the owner's site URL.

    JavaScript event

    This type of goal lets you track events on a site (button clicks, form submissions, and other events).

    When this type of goal is completed, the information is transmitted to Yandex.Metrica using JavaScript. The goal identifier is specified when the goal is created. When the goal is completed, the reachGoal method is called and this identifier is passed to it. In Ecommerce, information about a completed goal can be transmitted using the goal_id field along with the action data.

    In this way, you can track almost any events.

    Restriction.

    Use identifiers that aren't contained in the site's page URLs.

    Goal identifiers must not contain the following symbols: /, &, #, ?, =.

    Multi-step goal

    This type of goal lets you set a sequence of steps that the user completes to reach a goal. Each step is described using Page view or JavaScript event types of goals.

    When creating a goal, note the following:

    • A multi-step goal may contain a maximum of five steps.
    • Don’t forget that each step must require completing the previous step. For example, if a user can skip the first step and immediately perform the second step, the goal is not considered completed.
    • The steps don't have to be completed directly one after another. On their way to the goal, users might visit different pages of the site and perform other actions not related to the goals of the steps.
  5. Click Add goal. The created goal is shown in the list of goals.
  6. Click Save.

If goals are set up this way, Yandex.Metrica begins collecting statistics for the created goals several minutes after saving settings. You can view statistics in the Conversions report.

Note.
  • Up to 200 goals can be set for each counter.
  • The service registers a user completing the same goal on the same counter no more than once per second.
  • During a single user session, the service can register up to 400 completions of all the goals created for the counter.
  • If you edit a counter and change the goal information, all the previously collected information is not recalculated.
  • If you delete a goal, the information collected for it will not be available in reports.
  • Some users might complete the goal somewhere other than on the site, such as by making a phone call. To count this type of data, you can use Target Call.

  • If you want the goal to be completed for pageviews with URLs containing the plus sign, put “%2B” in the template in place of the + character.

    Example

Verifying a goal

To verify that information about the goal was sent, you can use the _ym_debug parameter in the page URL with the value 1. In this case, a message about completed goals is output to the browser console.

The browser console usually opens with the keyboard shortcut Ctrl + Shift + J ( + + J for Mac).

http://example.com/?_ym_debug=1

If the console doesn't show any data, it means the goal wasn't registered by Yandex.Metrica for any of a number of reasons.

Why aren't my goals registering?

Yandex.Metrica can't register goal completions in the following cases:

  • The counter isn't installed on the target page. If you think know the counter is installed, make sure it is installed correctly. If part of the content is displayed in an iframe, you also need to install the counter code inside the iframe in order for goals to register.
  • Other scripts are blocking the counter on the site.
  • The counter is blocked by the Adblock Plus extension.
  • The user left the page before the counter loaded.

The following issues may also occur depending on the type of goal:

JavaScript event

  • The goal identifier in the reachGoal method does not match the identifier in the counter settings.
  • The code for calling the reachGoal method is missing.
  • The reachGoal method was added correctly, but the event that triggers this method doesn't occur (for example, if the onsubmit event for submitting form data didn't take place).
  • The reachGoal method was called before the counter code initialized. In this case, the browser console shows the error “yaCounterХХХХХХ is not defined”. We recommend adding the triggerEvent parameter to the counter code and also making it possible to complete the goal after checking for counter initialization.

Page view

  • The URL of the target page isn't specified in the goal settings, or is specified incorrectly.
  • The conditions in the goal settings are too strict (for example, the condition is “url: matches” instead of “url: contains”).
  • Webpage URLs contain the # symbol. In this case, if the page doesn't refresh on a click-through, data isn't transmitted to the counter. We recommend enabling the Hash tracking in the browser address bar option in the counter settings, and then updating the counter code on all the site's pages.
  • The page has a redirect loop.

Multi-step goal

  • One or more of the steps can't be completed. We recommend checking whether the goal steps are set up correctly.
  • Make sure that each step can't be completed without completing the previous one.