Checking E-commerce settings

To check whether E-commerce is set up correctly:

  1. Go to the tag settings in Yandex.Metrica and make sure that:

    • The E-commerce option is enabled.
    • The Data container field contains the value dataLayer (default) or some other value.
  2. Check that the code snippet on your site contains the ecommerce:true or ecommerce:"data container" parameter (the default value is ecommerce:"dataLayer"). In the latter case, the name of the data container must match the one specified in the tag settings.

  3. Append the ym_debug=2 parameter to the page URL in the browser’s address bar and reload the page.

    http://example.com/?_ym_debug=2
    
  4. Perform an action on the page: for example, add an item to the shopping cart. It must correspond to the event Adding an item to the basket.

    At the bottom of the page, click . The debug panel appears.

    Note

    The _ym_debug=2 parameter only works if the new Yandex Metrica code snippet is installed on the website. If you have an older version of the code snippet or the debug panel doesn’t appear, use the browser console.

  5. If the E-commerce tab contains information about the action, it means that the order data has been transferred to Yandex Metrica.

You can also log your actions when working with the debugger.

Checking via the browser console

Use this method if your website has an older version of the Yandex Metrica tag.

  1. Go to the tag settings in Yandex.Metrica and make sure that:

    • The E-commerce option is enabled.
    • The Data container field contains the value dataLayer (default) or some other value.
  2. Check that the code snippet on your site contains the ecommerce:true or ecommerce:"data container" parameter (the default value is ecommerce:"dataLayer"). In the latter case, the name of the data container must match the one specified in the tag settings.

  3. Append the ym_debug=1 parameter to the page URL in the browser's address bar and reload the page.

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

    Next, open the browser console with the keyboard shortcut Ctrl + Shift + J ( + + J for Apple OS).

  4. Perform an action on the page: for example, add an item to the shopping cart. It must correspond to the event Adding an item to the basket.

  5. If you see ecommerce in the parameters, and then add at the level below, the data format matches the example provided in the Adding an item to the basket event, this means that the order data has been sent to Yandex Metrica. After a while, it appears in reports.

Checking the correctness of the transmitted data

The example checks the data that is passed in the event Adding an item to the basket.

  1. Check that the code snippet on your site contains the ecommerce:true or ecommerce:"data container" parameter (the default value is ecommerce:"dataLayer"). In the latter case, the name of the data container must match the one specified in the tag settings.

  2. Open the browser console with the keyboard shortcut Ctrl + Shift + J ( + + J for Apple OS).

  3. In the console settings, enable the option Preserve log.

  4. Perform an action on the page: for example, add an item to the shopping cart. It must correspond to the event Adding an item to the basket.

  5. In the console, insert the command JSON.stringify(<container name>). The default value is JSON.stringify(dataLayer).

If in the console:

There is information about the data array.

  1. Copy the array (except for the outer square brackets).
  2. To view the data, use any JSON parser.
  3. Make sure that the data format matches the event Adding an item to the basket.

The error “dataLayer is not defined” was displayed.

This means that the line window.dataLayer = window.dataLayer || []; is missing from the code of the page where you are checking the event. To set up data transfer, see Transmitting E-commerce data.

An empty data array was displayed in the form of [] (square brackets).

This means that the array is declared (in the example dataLayer), but data transmission is not set up for the event being checked.

Learn more

Chat with us

Write an email

Please note: Our support team will never initiate a call to you. Do not follow any instructions of people who call you and introduce themselves as the Yandex Metrica support team.