Session Replay

In this section, make settings for saving the contents of site pages for playing back user sessions. Before making settings, turn on the Session Replay option in the Counter code section.

Note.
  • Session Replay records user actions correctly if UTF-8 encoding is used on the site.
  • Data is stored for 15 days, including the current day.
  1. Recording page contents
  2. Loading pages in the player
  3. FAQs

Recording page contents

By default, Session Replay records only user actions on the page, not the page content.

If recording page content isn't turned on, the current versions of site pages are used during playback. They may differ from the versions seen by the user.

There are two ways to record page content: by the browser while the user is viewing a page, or by a Yandex.Metrica robot. In both cases, only the HTML code of pages is saved (images, CSS, and JavaScript are not saved). In addition, the size of the page's code must not exceed 185 KB.

During playback, data may be transmitted via the Yandex proxy server (*.mtproxy.yandex.net). If your site checks the domain name, add an exception, such as using the regular expression

/^(.*\.)?mtproxy\.yandex\.net$/i

Example:

if (/^(.*\.)?mtproxy\.yandex\.net$/.test(document.domain)) {
   [user_code]
}
Recording pages during viewing

The counter records both the user's actions and the content of pages with URLs that match the pattern set in List of pages to save. Playback is guaranteed to show the version of the page that the user's browser loaded. This option is recommended for pages with content that is unique to each user, such as the “Basket” section.

There are two ways to get the page content:

  • From the browser. The HTML code corresponds to the current representation of the page in the DOM model of the user's browser. This is the most accurate representation of the page. It takes into account any manipulations that were made with a page included in it using JavaScript code.
  • Using a separate request. The HTML code of the representation exactly matches the HTML code of the page at the moment of loading. However, the results of executing JavaScript are not taken into account.

The list of pages to save is defined using conditions on individual strings. A condition may be a full page URL or part of one (a substring), or a regular expression. In the last case, use the regexp: prefix.

Examples:

  • /path?query — Record pages containing the string /path?query.
  • regexp:http://example.com/.* — Record pages like http://example.com/abc and http://example.com/ab/cd.
  • regexp:.* — Record all pages.

Loading pages in the player

When playing back a user's actions, either a saved copy or the current version of the page is loaded. The page representations have the following priority (from highest to lowest): a copy of the page saved from the browser, a copy recorded by the robot, the current page on the website.

The current page on the website is loaded to the player using an iframe. If your site is protected from being shown in an iframe (the X-Frame-Options header is used in the server settings), the collected data won't be available for viewing. To view the site's session data, you must change the server settings and add an exception for the webvisor.com domain and subdomains, as well as for your site's domain. Use the regular expression

^https?:\/\/([^\/]+\.)?(yourdomain\.com|webvisor\.com)\/

If you use nginx, add the following exceptions to your configuration:

location / {
        set $frame_options '';
        if ($http_referer !~ '^https?:\/\/([^\/]+\.)?(yourdomain\.com|webvisor\.com)\/'){
            set $frame_options 'SAMEORIGIN';
        }
        add_header X-Frame-Options $frame_options;
        ...
    }

where yourdomain\.com is your site's domain name. Use your site's domain zone (it may differ from .com).

Regardless of which page representation is used, the page can be loaded as follows:

  • As you — the player loads the same page that you would see if you visited the site yourself.

    If you are logged in on the site, this username will also be used in the player. If there is a shopping basket on the site and you put products in it, you will see the contents of your own basket during playback, and not the basket of the user whose session you are viewing.

  • As an anonymous user — the player loads the page that a first-time user would see on the site. If the site has user login, the player loads the version of the page that is seen by users who are not logged in.

    We recommend using this method if playing back users' actions results in undesired effects, such as adding new products to your own shopping basket each time.

FAQs

  1. The Session Replay report does not have any data
  2. The Session Replay report does not include any demographic data (gender, age, and so on).
  3. The Session Replay report shows fewer sessions than other reports do
  4. The Referral from site field shows my own site, but the traffic was from an ad
  5. When viewing records, I see the message There is a problem with this page...
  6. Why are some sessions empty?
  7. Does Session Replay increase the load on my site?
  8. Does Session Replay increase the data used by my site's users?
  9. Does the quality of my site layout affect how Session Replay works?
  10. What should I do if Session Replay doesn't work in my browser?
  11. Will sessions on sites with flexible layouts be reproduced correctly?
  12. A webpage is password protected. Why does the playback just show the login page instead of the entire replay?
  13. Session Replay player shows an error or invalid page instead of the page confirming that a form was sent. Why?
  14. Why aren’t user actions replayed in the Flash sections of the site?
  15. Why does the page reload when I try to view pages with the player?
  16. Does Session Replay record users' passwords?
  17. How can I stop Session Replay recording keystrokes in certain fields?
  18. Session Replay submits a form when replaying sessions
  19. How long does Session Replay store recordings of sessions?

The “Session Replay” report does not have any data

Session Replay is not enabled automatically when creating a counter. To learn how to enable it, see the section Counter code.

When enabling Session Replay, don't forget to click the Save button. Otherwise, report data will not be displayed.

To correctly display the content of dynamic web pages (which use the WebSocket protocol), disable the Pages recorded during user session option.

The “Session Replay” report does not include any demographic data (gender, age, and so on).

Yandex.Metrica protects users' privacy and ensures that all collected information is depersonalized. For this reason, certain information such as social-demographic data (gender, age, and so on) has limited disclosure. Such data is provided only if there were more than 10 users in the sample.

This information can't be shown in the report, since Session Replay records the actions of each user individually.

The “Session Replay” report shows fewer sessions than other reports do

Session Replay records up to 150,000 visits a day with a margin of error. The system provides a representative sample by recording a spread of sessions throughout the day.

The “Referral from site” field shows my own site, but the traffic was from an ad

This may be caused by the following reasons:

  • The link from the ad points to a page that does not have the counter code installed on it. As a result, Yandex.Metrica cannot correctly register the referral source. When a user goes to the next page (where the counter code is installed), your site is recorded as the session source in reports. To avoid these types of errors, make sure that the counter code is installed correctly on every page on the site.
  • The counter was not triggered on one of the pages that ad links point to. This may happen if a user goes to a different page before the Yandex.Metrica code loads, or if there is a redirect on the page.

When viewing records, I see the message “There is a problem with this page...”

This message may appear for several reasons:

  • Your site uses protection against rendering in an iframe (the site returns the header X-Frame-Options: SAMEORIGIN or X-Frame-Options: DENY).

    To correctly replay sessions, you must delete the protection code (contact the person responsible for site support), or configure the web server.

  • A firewall on the computer or network is blocking access to:

    • The domains metrika.yandex.ru and mc.yandex.ru.
    • The domain *.yandex.net, if the Downloading pages into player option is selected in Session Replay settings (the as an anonymous user type).
    • The domain *.yandex.tld.
  • The site does not open without the www prefix.

Why are some sessions empty?

A certain percentage of visits to any site may not display any activity. This happens either because nothing actually happened on the page during the session, or because the actions could not be recorded.

Reasons for nothing happening on the page:

  • A web crawler visited your site.
  • Your page was loaded in a tab when a browser restored a user’s previous session.

Reasons for actions not being recorded:

  • The counter code does not support Session Replay. Turn on the Session Replay option on the counter settings page and update the code on your site.
  • The user left your page without waiting for it to load.
  • The user was using a browser that does not support recording (for example, a mobile browser).
  • The visitor used a non-standard device to view the page (for example, a touch device).
  • The user had a slow internet connection (for example, mobile internet).

Does Session Replay increase the load on my site?

No, the load on your site will not increase, because all the user actions are recorded in users' browsers after your webpage has loaded.

Does Session Replay increase the data used by my site's users?

Depending on the page size and viewing time, the data transferred per session ranges from 200 bytes to 4 kilobytes (this is less than 5% of the average page size in the internet). Such an increase in traffic will be negligible compared to the amount of data used when visiting your site.

Does the quality of my site layout affect how Session Replay works?

If there are a large number of HTML layout errors (unclosed tags, incorrect nestings, etc.), this may lead to inaccuracies in session replays. Session Replay usually adapts to such errors, but having correct HTML structure on site pages is preferable.

What should I do if Session Replay doesn't work in my browser?

Session Replay supports most modern computer browsers. There is limited support for recording sessions in beta versions and in certain mobile browsers.

We recommend keeping your browser updated to the latest version available. Session playback is supported in these browsers: Yandex.Browser, Google Chrome, Firefox, Safari, Opera, and Internet Explorer.

Note. Different browsers may process the same page in different ways. This means that to accurately replay a session, you should use the same browser as it was originally recorded in.

Will sessions on sites with flexible layouts be reproduced correctly?

Yes. Sessions on pages with flexible layouts will be replayed correctly, even if the resolution of the user’s screen is not the same as the replay screen. During playback, you might see small cursor jumps due to different relative positioning of elements on the recorded and replayed pages.

A webpage is password protected. Why does the playback just show the login page instead of the entire replay?

Session Replay does not record passwords and makes no attempt to log in to a site on behalf of a user. Therefore, the player loads the login page, just like any other user who has not logged in.

For the player to play back the page content, go to the Session Replay tab on the counter editing page and turn on the option Pages recorded during user session (the type of recording doesn't matter).

Session Replay player shows an error or invalid page instead of the page confirming that a form was sent. Why?

Most likely, the form sends data using the POST method.

When loading data to the player, Session Replay only uses the GET method. This is because POST requests usually cause some action to be performed: submit a form, complete checkout, etc. If Session Replay used the POST method, it would be fully emulating a user's actions, and every time you viewed the page using the player, you would get a duplicate form submitted or have a duplicate order created on the site.

In order for the page confirming form submission to be displayed correctly in the player, go to the Session Replay section on the counter editing page, then turn on the option Pages recorded during user session (the From browser type).

Why aren’t user actions replayed in the Flash sections of the site?

Session Replay only records user actions performed in the HTML sections of a site. In addition, user interactions with Flash elements are not recorded. Only mouse movements over these elements are recorded. The cursor may disappear when playing these movements. This is due to the fact that Flash elements are by default displayed above the page's content in the browser, including the cursor displayed by the player.

To make the cursor visible on Flash elements, set the display mode for them to wmode=transparent:
<object>
    <param name="wmode" value="transparent">
    ...
    <embed wmode="transparent" ... />
</object>

Why does the page reload when I try to view pages with the player?

You probably have some sort of protection from rendering pages within a frame. It may look something like this:

<script type="text/javascript">if (top.location != self.location)
{
 top.location.replace(self.location)
}
</script>

In order for sessions to replay correctly, you’ll need to delete this code.

Does Session Replay record users' passwords?

No. Session Replay does not record what is entered in a password type field.

How can I stop Session Replay recording keystrokes in certain fields?

To prevent information from specified fields from being recorded, set the CSS class -metrika-nokeys for them. This class can be used for marking fields with private information.

Session Replay submits a form when replaying sessions

When replaying sessions, sometimes a duplicate form may be submitted in the name of the user on the site (for example, another product is added to the shopping basket).

To prevent this, set the CSS -visor-no-click class for form elements:

<form action="/login" method="post" class="-visor-no-click"></form>

How long does Session Replay store recordings of sessions?

Yandex.Metrica stores session recordings for the previous two weeks.