How Yandex Metrica works

To start working with Yandex Metrica, create a tag — a code snippet embedded in web page content. When a tag is created, Yandex Metrica simultaneously creates a data store associated with it.

Users interact with the webpages of a site where the tag is installed. The tag code is executed and it transmits data to Yandex Metrica about the page itself and the events that occurred when the user interacted with it.

  1. Collecting and transmitting data
  2. Quotas
  3. Processing and storing data
  4. Receiving and displaying data. Metrics

Collecting and transmitting data

The code snippet consists of two parts: JavaScript code in the script element, and HTML code in the noscript element.

If the page is loaded by a browser, the standard behavior is as follows. If the browser supports execution of JavaScript code and execution is not blocked by browser settings or add-ons, the JavaScript code in the script element runs. Otherwise, the content of the noscript element is processed.

If the page is loaded by something other than a browser (for example, a robot), the interpretation of the tag code may be arbitrary.

When the tag's JavaScript code isn't executed, only a limited amount of information can be collected. The Yandex Metrica server extracts session information from HTTP request headers to download an image. The link to the image is inside the noscript element. The information that can be extracted from HTTP request headers includes the user's IP address, the URL of the page containing the image, browser and OS information, cookie data, and the absence of JavaScript support (based on the noscript element).

When the tag's JavaScript code is executed, much more information is available. The JavaScript code has access to information about the HTML page title, the URL of the traffic source, parameters of the screen and the browser window, browser plug-ins and extensions (Java, Silverlight, Flash), and so on. In many cases it is most significant that the JavaScript code can track events that occur while the user is interacting with the page. This includes filling in and submitting forms, clicking links, and scrolling. In addition, the JavaScript code measures page loading parameters (such as rendering time) and can transmit data about goals completed.

With Yandex Metrica you can get more information about users and their interaction with site pages than a tag can collect. For example, the browser doesn't have information about the user's gender, age, or locality. This information is detected by the service. Significant computing resources and large volumes of data are often used for this purpose.

In this way, data collected by a tag is processed on Yandex Metrica servers and is supplemented with various information.

Quotas

To ensure maximum service availability, Yandex Metrica imposes limitations on the number of data requests from users (quotas). Quotas are used in the Yandex Metrica API. The web interface, in turn, can use API methods, that is, exhaust the same quota. When the quota is exceeded, a message warning you about that appears in Yandex Metrica:

  • On the Dashboard page when displaying widgets. For example, if widgets are open on multiple browser tabs at the same time or multiple tag users are working with them.
  • When displaying reports. For example, if several tag are viewing reports or working with the same report at the same time.

A similar situation can occur if you're simultaneously sending requests to the Yandex Metrica API and working with the web interface.

A quota may also be exceeded due to browser add-ons or malware activity. In this case, we recommend disabling your browser add-ons and checking your OS for viruses.

If you suspect that someone else made requests using your username:
  1. Under Sign in and device history, click Log out on all devices.
  2. Go to your account settings again and change your password. Then click Log out on all devices again.

Processing and storing data

The collected data is processed by the service. Statistical objects are formed in the tag's storage based on this data.

The incoming data is processed on a continuous basis and usually becomes available for analysis in reports within 10–15 minutes after a respective event has occurred. But in some cases, this processing may take longer.

Yandex Metrica works with several data levels and operates with the following types of statistical objects:

Object Level

pageview

page load

file download

outbound link click

Basic
Session Second
User Third

A statistical object is defined by a set of attributes.

Some of the attributes are shared by all types of statistical objects. For example, any type of object can have the operating system and user's country defined, if this information was detected.

Some attributes are specific to certain types of statistical objects. For example, a defining pageview attribute is the page URL of the click (referer), a session attribute is the session length, and a user attribute is the date of the user's first session.

These levels can be represented in a diagram:

You can transmit additional parameters to Yandex Metrica while users are interacting with the site. However, it is important to differentiate between session or pageview parameters and user parameters. User parameters differ from session or pageview parameters in that they aren't tied to a specific time of the site session.

For example, the “send feedback” event belongs to a specific session, because the user could only submit the feedback once over the entire history of sessions. There isn't any point in making this event a user attribute, because the reports would make it look like this user submitted the same feedback once during every session.

To compare the behavior of users who have left feedback at least once with those who have never sent feedback, you need to configure sending this event via session parameters, and then create the appropriate segments. The user parameters should only transmit attributes that don't change from session to session, and that don't contain users' personal information. For instance, you can transmit the type of client — “retail” or “wholesale”.

Receiving and displaying data. Metrics

Each object is defined by the start time of the corresponding event (or sequence of events).

So we can select statistical objects of a specific type within a certain time period. Then we can use attribute values to calculate a variety of absolute or average numbers. These numbers are called metrics. Examples are the overall number of pageviews, or the number of sessions with a depth greater than 5.

Metrics are always calculated for the same type of statistical objects.

A typical task when analyzing metrics is to determine how much one of the groups contributes to the total. For example, you may want to find out how many of a site's users are men, and how many are women. In Yandex Metrica, you can define groups of objects using conditions placed on attribute values, and calculate the metric values for each group. This process of breaking up a total into its parts is called dimensions.

Often you don't need all the objects, but just those that match the specified criteria. For example, you want to analyze the behavior of users who click through from ads. In Yandex Metrica, you can form a sample of desired objects using conditions placed on attribute values. This process is called segmentation, and the selected set of objects is a segment.

Segmentation and dimensions can be used together. For example, you can select a segment of sessions that came from search engines, and group the sessions by keyword.

For viewing and analyzing metrics, reports and widgets are used. For studying user behavior, Session Replay, maps, and the form analysis service are available.