Creating a Yandex.Metrica Logs API connection
Before creating a connection to the Yandex.Metrica Logs API, you need to create a ClickHouse cluster in Yandex.Cloud. DataLens saves Logs API data to a dataset in the created cluster.
Connecting to the Yandex.Metrica Logs API
To create a connection to the Logs API:
Go to the connections page.
Click Create connection.
Select the Metrica connection.
Specify the connection parameters:
Connection name. Specify a name for the connection. You can set any name.
OAuth token. Click Get token or enter the OAuth token manually to access the Yandex.Metrica data.
Tag. Specify the tag to connect to.
Connection. Select Logs API as the connection type.
If you want to get access for a username other than your current Yandex account or there is no relevant tag in the list, see Getting an OAuth token.
Specify the data export parameters:
- Tag source. Specify the data table to be exported from the Logs API.
- Upload from. Specify the start date for exporting data.
- Frequency. Specify how often data is updated in the connection.
Specify information about the target database:
- Hostname. Specify the path to the ClickHouse cluster host in Yandex.Cloud.
- Port. Specify the DB connection port.
- Database name. Specify the name of the DB to connect to.
- Cluster. Specify the DB cluster.
- Username. Specify the username for the DB connection.
- Password. Enter the password for the specified user.
Click Connect. The connection appears in the list.
- Uploading data to the connection may take anywhere from a few minutes to a few hours depending on the amount of data in the tag and the specified start date.
- Changing the Upload from parameter fully resets the connection data.
- Changing the Frequency value from
Regularfully resets the connection data.
Getting an OAuth token
You can specify an OAuth token of any Yandex account.
To get access to a Yandex.Metrica tag for a username other than your current Yandex account, follow these steps:
- Switch to an account that has access to Yandex.Metrica.
- Use the link to get a token. If necessary, allow access to the application, then copy the token.
- Switch to an account that has access to Yandex DataLens.
- Create a new connection to Yandex.Metrica and paste the obtained token from the clipboard to the OAuth token field.