[Yandex Cloud documentation](../../index.md) > [Yandex DataLens](../index.md) > [Tutorials](index.md) > Service analytics > Yandex Metrica: direct connection

# Yandex Metrica: Direct connection



{% note info %}

For advanced analysis of raw Yandex Metrica data and access to the full range of DataLens analytical functions, we recommend using data export to ClickHouse® available as part of the [Metrica Pro](https://yandex.ru/project/metrica/pro) package.

For the Metrica Pro package, real-time data streaming is available. For more information, see [this guide](https://yandex.ru/support/metrica/en/pro/data-work).

{% endnote %}


This tutorial demonstrates how to use Yandex DataLens with Yandex Metrica in direct access mode.

As the data source, use a Yandex Metrica tag you have access to. View the list of available tags [here](https://metrika.yandex.com/list).

![image](../../_assets/datalens/solution-03/01-metrica-list.png)

If there are no available tags in the list, use the Yandex Metrica [demo dashboard](https://datalens.ru/marketplace/f2e5hpq5mc7bscsjc6jr).

{% note info %}

In this tutorial, all objects will be created and stored in a workbook. If using legacy folder navigation, create an individual folder to work in. 

{% cut "Create a folder" %}

1. Go to the DataLens [home page](https://datalens.ru/?skipPromo=true).
1. In the left-hand panel, select ![](../../_assets/console-icons/folders.svg) **All objects** or ![](../../_assets/console-icons/folder-house.svg) **Personal folder**.
1. In the top-right corner, click **Create** → **Folder**.
1. Enter a name for the folder.
1. Click **Create**.

{% endcut %}

{% endnote %}

To visualize and explore data, [set up DataLens](#before-you-begin) and follow the steps below:

1. [Create a workbook](#create-workbook).
1. [Create a connection and a standard dashboard](#create-connection).
1. [Edit the standard dashboard](#edit-dashboard).
1. [Edit the chart](#edit-chart).


## Getting started {#before-you-begin}

To get started with DataLens:


{% list tabs group=datalens_user %}

- New user {#new}

  1. [Log in](https://passport.yandex.com/auth) to your Yandex account. If you do not have an account, [create](https://yandex.ru/support/passport/authorization/registration.html) one.
  1. Open the DataLens [home page](https://datalens.ru/promo).
  1. Click **Start in cloud**.
  1. Confirm that you have read the [Terms of use](https://yandex.com/legal/cloud_termsofuse/?lang=en) and click **Log in**.

- I am already using Yandex Cloud {#already}

  1. [Log in](https://passport.yandex.com/auth) to your Yandex account.
  1. Open the DataLens [home page](https://datalens.ru/promo).
  1. Click **Start in cloud**.
  1. Select one of these options:

     * If you already have an organization, select it from the drop-down menu in the **Organizations** tab and click **DataLens**.

       {% note info %}

       To activate a DataLens instance, the user must have the `admin` or `owner` role. For more information about roles, see [Access management in Yandex Identity Hub](../../organization/security/index.md).

       {% endnote %}

     * If you have a cloud but no organization, click **Add new DataLens**. In the window that opens, enter a name and description for your organization and click **Create organization and DataLens**. For more information about working with organizations, see [Getting started with organizations](../../organization/quickstart.md).

{% endlist %}

If you encounter a technical issue with the service, contact Yandex Cloud [support](https://center.yandex.cloud/support). To ask for advice, discuss a solution to your issue, or explore current best practices, join the [DataLens](https://t.me/YandexDataLens) chat in Telegram.


## Create a workbook {#create-workbook}

1. Go to the DataLens [home page](https://datalens.ru/?skipPromo=true).
1. In the left-hand panel, select ![collections](../../_assets/console-icons/rectangles-4.svg) **Collections and workbooks**.
1. In the top-right corner, click **Create** → **Create workbook**.
1. Enter `Metrica Live Demo` for the [workbook](../workbooks-collections/index.md) name.
1. Click **Create**.

## Create a connection and a standard dashboard {#create-connection}

{% note warning %}

This step describes actions for users with permissions for any Yandex Metrics tag. If you do not have permissions for a tag, deploy a [dashboard from DataLens Marketplace](https://datalens.ru/marketplace/f2e5hpq5mc7bscsjc6jr) and proceed to [Edit the standard dashboard](#edit-dashboard).

{% endnote %}

1. In the top-right corner of the workbook, click **Create** → ![image](../../_assets/console-icons/thunderbolt.svg) **Connection**.
1. Under **Files and services**, select the **Yandex Metrica** connection.
1. Click **Get token**.

   If this is your first connection to a Yandex Metrica tag, grant the required permissions to the service.

1. Select the tag from the drop-down list.

   The maximum number of Yandex Metrica tags is 1,000.

1. Select the [accuracy](https://yandex.com/dev/metrika/doc/api2/api_v1/sampling-docpage/) level from the drop-down list.
1. Enable **Automatically create dashboard, charts, and dataset on top of connection**.
1. Click **Create connection**.

   ![image](../../_assets/datalens/solution-03/03-create-metrica-coonection.png)

   1. Enter the connection name: `Demo Connection to Metrica Live`.
   1. Click **Create**.

   When the connection is created, a workbook or folder containing the datasets, charts, and dashboard will open.

   ![image](../../_assets/datalens/solution-03/04-metrica-objects-list.png)

   {% note info %}
   
   * By default, Yandex Metrica data is exported for the last 60 days. If you add a filter by date to the chart, the Yandex Metrica filter will be reset. We recommend adding a filter by date as an offset relative to the current date.
   * On the Metrica side, there is a quota of three concurrent requests per user (`user_login`).
   
   {% endnote %}

## Edit the standard dashboard {#edit-dashboard}

{% note warning %}

If you skipped the [Create a connection and a standard dashboard](#create-connection) step, deploy the [dashboard from DataLens Marketplace](https://datalens.ru/marketplace/f2e5hpq5mc7bscsjc6jr).

{% endnote %}

You can customize the standard [dashboard](../concepts/dashboard.md) by deleting, moving, or editing charts.

1. Open `Metrica Live Demo Dashboard`.
1. In the top-right corner of the dashboard, click **Edit**.
1. Delete the `Page depth` chart. Click ![image](../../_assets/console-icons/ellipsis.svg) in the top-right corner of the chart and select **Delete**.

   ![image](../../_assets/datalens/solution-03/10-delete-charts1.png)

1. Position the `Bounce rate` and `Time on site` charts so that they fill in the empty space left after deleting the chart in the previous step:

   ![image](../../_assets/datalens/solution-03/11-replace-charts.png)

1. Remove the `Percentage of visits by browser` and `Sessions, views, and users by browser` charts.
1. In the top-right corner of the dashboard, click **Save**.

## Edit the chart {#edit-chart}

You can edit any chart on the dashboard. For example, change the visualization type for the `Sessions by device type and OS` chart from the **Technologies** section.

1. In the top-right corner of the `Session by device type and OS` chart, click ![image](../../_assets/console-icons/ellipsis.svg).
1. Select **Edit**.

   ![image](../../_assets/datalens/solution-03/14-edit-chart.png)

1. Select a different chart type: **Pie chart**.

   ![image](../../_assets/datalens/solution-03/15-choose-pie.png)

1. In the top-right corner, click **Save**.
1. Close the chart editing page and go back to the dashboard window.
1. Update the dashboard and make sure the chart changed in the **Technologies** section.

   ![image](../../_assets/datalens/solution-03/17-refresh-dashboard.png)