Goals on Turbo pages created in Yandex Webmaster

Goals for an informational site

To track the users' interaction with the Turbo page elements, use a “JavaScript event” goal.

  1. Add the turbo:goal element to an RSS feed:

    ...
    <turbo:goal type="yandex" turbo-goal-id="goal-link" name="TARGET" id="12345" />
    <turbo:content>
       <![CDATA[
           ...
       ]]>
    </turbo:content>
    

    where

    • name is the goal ID.
    • id is the tag number.
    • turbo-goal-id — ID to assign to the Turbo page content
  2. Add the ID to the content you want to track statistics for, as the data-goals attribute value. You can specify multiple comma-separated values, i.e., you can bind multiple goals to a single element on a Turbo page.

    <turbo:content>
        <![CDATA[
            <p><a href="http://example.com/" data-goals="goal-link,goal-link2">Text</a></p>
        ]]>
    </turbo:content>
    
  1. Add the turbo:goal element to an RSS feed:

    ...
    <turbo:goal type="yandex" turbo-goal-id="goal-link" name="TARGET" id="12345" />
    <turbo:content>
    <![CDATA[
    ...
    ]]>
    </turbo:content>
    

    where

    • name is the goal ID.
    • id is the tag number.
    • turbo-goal-id — ID to assign to the Turbo page content
  2. Add the ID to the content you want to track statistics for, as the data-goals attribute value. You can specify multiple comma-separated values, i.e., you can bind multiple goals to a single element on a Turbo page.

    <turbo:content>
    <![CDATA[
    <p><a href="http://example.com/" data-goals="goal-link,goal-link2">Text</a></p>
    ]]>
    </turbo:content>
    
  3. In Yandex Metrica, use the left menu to go to the Goals page and click Add goal.

  4. In the Name field, enter a name for the goal to create.

  5. Choose the JavaScript event goal type.

  6. Specify the desired condition and goal identifier. Below the identifier field, the Goal code for site line will appear. Copy the code. You will need it to configure the reachGoal method on your site.
    Examples of using the reachGoal method on site pages:

    ...
    <form action="">
        ...
        <input type="button" onclick="ym(XXXXXX, 'reachGoal', 'TARGET_NAME'); return true;" value="Order" />
    </form>
    ...
    
    ...
    <form action="" method="get" onsubmit="ym(XXXXXX, 'reachGoal', 'TARGET_NAME'); return true;">
        ...
    </form>
    ...
    
    ...
    <form action="">
        ...
        <input type="button" onclick="ym(XXXXXX, 'reachGoal', 'TARGET_NAME', {order_price: '1000.35', currency: 'RUB'}); return true;" value="Order"/>
    </form>
    ...
    
    How to send revenue data using an attribute selector

    To transfer revenue as order_price from all pages of the site where it is set by an attribute selector (for example, class or id), pass the selector name along with the revenue data to Yandex Metrica.

    1. Find the fragment in your site code where a selector of this type is set. Example:

      <div class="ORDER">Order amount: <div class="PRICE">110</div> RUB</div>
      
    2. Add the selector name to the code of the element that will send the revenue by goal to Yandex Metrica. Example:

      <input type="button" onclick="ym(XXXXXX, 'reachGoal', 'BUY', {order_price: document.querySelector('.PRICE')?.textContent}); return true;" value="Order" />
      
    • XXXXXX — Your tag number.
    • TARGET_NAME — Goal ID.
    • order_price — Revenue by goal. You can specify revenue in a currency or in conventional units.
    • currency — Currency of the revenue by goal. Yandex Metrica recognizes a three-letter ISO 4217 currency code.
  7. Click Add goal. The created goal will appear in the list of goals. Yandex.Metrica will start collecting statistics on it within a few minutes.

Data transmission to Yandex Metrica will start after the robot crawls the RSS feed and detects changes.

The created goal can be used in most Yandex Metrica reports. You can also track conversions by goal using the Conversions report.

Chat with us

Write an email

If you were unable to independently check the tag, follow the recommendations below.

This might happen for the following reasons:

  • The tag is installed incorrectly. For example, the CMS modified the tag code. Reinstall the tag or contact the support service for your CMS.
  • Broken scripts are preventing the Yandex Metrica tag from working on the site. You can check this in the browser console.
The recommendations did not help

This means that information is being transmitted to Yandex Metrica. However, the data might not be shown in reports for any of the following reasons:

  • Data is sent to a tag with a different number.
  • The Filters tab in the tag settings has overly strict filters defined. Remove unneeded filters.
  • The Filters tab in the tag settings has the Don’t count my sessions filter enabled. This means that the tag doesn't register your own sessions. Try accessing the site with your browser in “incognito” mode.
The recommendations did not help