
Analytics
YandexNet.Metrika
.NET SDK for the Yandex Metrika API
netstandard2.0net8.0net10.0
Features
- Goals: list, create, update and delete
- Offline-conversion upload with server-side revenue attribution
- Reading reports
- OAuth 2.0 helpers or bring-your-own token
- Stateless, only depends on System.Text.Json
Installation
dotnet add package YandexNet.MetrikaQuick start
using YandexNet.Metrika;
using var http = new HttpClient();
// Bring your own token — no OAuth round-trip needed.
var metrika = new YandexMetrikaClient(http, new YandexMetrikaClientOptions
{
AccessToken = accessToken,
});
var goals = await metrika.ListGoalsAsync(counterId);
var created = await metrika.CreateGoalAsync(counterId, new MetrikaGoal
{
Name = "app_open",
Type = "action",
Conditions = new[] { new MetrikaGoalCondition { Type = "exact", Url = "app_open" } },
});Key methods
ListGoalsAsyncList a counter’s goalsCreateGoalAsyncCreate a goalUploadOfflineConversionsAsyncUpload offline conversionsBuildAuthorizeUrlBuild the OAuth authorize URLExchangeCodeAsyncExchange the code for tokensREADMEgithub.com/ai-iskuzhin/YandexNet.Metrika
Loading README from the repository…