Skill

Analyze Yandex Metrica Data

Yandex Metrika analytics: traffic, conversions, UTM, and search-engine reports with a cache-first CLI workflow.

Works with yandex metrica

91
Spark score
out of 100
Updated 2 months ago
Version guardian-v1.0.0

Add to Favorites

Why it matters

Leverage Yandex Metrica data to understand website traffic, track conversions, and analyze search engine performance for better marketing insights.

Outcomes

What it gets done

01

Extract traffic source data

02

Analyze conversion metrics

03

Track UTM parameters

04

Monitor search engine performance

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/yandex-metrika | bash

Overview

Yandex Metrica

Yandex Metrika Reporting API v1 analytics for traffic, conversions, UTM tracking, and organic search, using a cache-first workflow to manage context window size and persist per-counter conversion-goal configuration. Use for analyzing Yandex Metrika traffic, conversions, UTM performance, ecommerce revenue, or Yandex Direct ad spend for a tracked site, or comparing two time periods.

What it does

This skill works with the Yandex Metrika Reporting API v1 to produce traffic, conversion, UTM-tracking, and organic search-engine reports. Its workflow is deliberately cache-first for context-window hygiene: configuration data (counter list, goals, counter metadata) is cached long-term, report results are cached by a key combining counter, date range, and parameters, and the cache is always checked before hitting the API. Because stdout output is capped at 30 lines, full report data goes to a CSV file rather than flooding the conversation, and cached data can be searched directly with grep/rg without ever loading it into context.

It defaults to precise, unsampled data (accuracy=1) with bot traffic filtered out by default, and defaults attribution to "lastsign" (last significant traffic source) - asking the user to confirm or change this on first use rather than assuming. Before any analysis it enforces a setup sequence: list available counters (searchable by name or domain), identify the specific counter/site being analyzed if not obvious from context, pull the counter's metadata and available goals, ask the user which of those goals actually count as conversions for their business, and persist that answer (attribution setting plus selected conversion goals) to a per-counter config file so future reports don't require re-asking.

Eleven scripts cover the reporting surface: counters.sh (list/search counters), goals.sh and counter_info.sh (metadata), traffic_summary.sh (traffic by source), conversions.sh (goal completions, defaulting to the saved config's goals), utm_report.sh (UTM breakdown), search_engines.sh (organic search engine traffic), ecommerce.sh (purchases, revenue, average order value, with auto-detected currency), direct_clients.sh/direct_costs.sh (Yandex Direct ad account logins and spend), and comparison.sh (comparing two date periods on chosen dimensions/metrics). Shared parameters across most scripts include date range, grouping (day/week/month), device filter, traffic source filter, attribution model, result limit, and CSV export path, though not every script supports every shared parameter - Direct-costs reporting in particular skips grouping/device/source filters.

When to use - and when NOT to

Use this skill when analyzing Yandex Metrika traffic, conversions, UTM campaign performance, organic search engine visibility, ecommerce revenue, or Yandex Direct ad spend for a specific tracked site, or when comparing performance across two time periods.

It requires a YANDEX_METRIKA_TOKEN configured in config/.env, and operates under a Reporting API limit of roughly 200 requests per 5 minutes - the scripts handle 429 rate-limit responses automatically, retrying if the server's suggested wait is 60 seconds or less and otherwise failing with a clear message, rather than silently hanging.

Inputs and outputs

Input is a counter/site identifier (by ID, name, or domain search), a date range, and optional grouping/device/source/attribution filters. Output is a traffic, conversion, UTM, search-engine, ecommerce, or ad-spend report, either summarized to 30 lines in stdout or exported in full to CSV, with configuration (attribution model, selected conversion goals) persisted per counter for reuse across sessions.

bash scripts/conversions.sh --counter <ID> --date1 2026-01-01 --all-goals --csv report.csv

Integrations

Built on the Yandex Metrika Reporting API v1, with a local cache directory structure (cache/counter_<id>/) storing metadata, goals, per-counter config, and report CSVs, searchable via standard grep/rg tooling.

Who it's for

Analysts, marketers, or growth teams working with Yandex Metrika who need efficient, cache-aware traffic/conversion/UTM/ecommerce reporting without repeatedly re-specifying counter configuration or flooding their session context with raw report data.

Source README

yandex-metrika

Work with Yandex Metrika Reporting API v1. Reports on traffic, conversions, UTM tags, and search engines.

Config

Requires YANDEX_METRIKA_TOKEN in config/.env.
Instructions: config/README.md.

Philosophy

  1. Cache-first - configuration data (counters, goals, info) is cached long-term. Reports are cached by key counter+dates+params. Always check cache before making API requests.
  2. Context window hygiene - stdout is limited to 30 lines. Full data goes to CSV/file. Cache is searchable via grep/rg without loading into context.
  3. Accurate data - accuracy=1 (no sampling), isRobot filter enabled by default.
  4. Attribution - default lastsign (last significant source). Ask user on first run.

Workflow

STOP! Before any analysis:

  1. Get the list of counters:

    bash scripts/counters.sh
    
  2. Ask the user (if counter is not obvious from context):

    "Which counter/website are we analyzing?
    Provide the ID, name, or domain."
    

    If user mentions a site/domain - search via --search:

    bash scripts/counters.sh --search "metallik"
    

    This greps the TSV (id + name + site), so it finds by domain too.

  3. Get counter info and goals:

    bash scripts/counter_info.sh --counter <ID>
    bash scripts/goals.sh --counter <ID>
    
  4. Ask about conversion goals:

    "Which of these goals are conversions for your business?
    [list of goals from goals.sh]
    I'll save your selection for future reports."
    
  5. Save configuration to cache/counter_<id>/config.json:

    {
      "attribution": "lastsign",
      "conversion_goals": [
        {"id": 12345, "name": "Order placed"},
        {"id": 67890, "name": "Lead submitted"}
      ]
    }
    
  6. Run reports based on user's task.

Scripts

General invocation pattern:

bash scripts/<script>.sh --counter <ID> --date1 YYYY-MM-DD [--date2 ...] [--group month] [--csv path]
Script Description Special params
counters.sh List of counters --search "query"
goals.sh Counter goals -
counter_info.sh Counter metadata -
traffic_summary.sh Traffic by source -
conversions.sh Goal completions --goals "ID,ID" / --all-goals; defaults to config.json
utm_report.sh UTM breakdown -
search_engines.sh Search engines (organic) -
ecommerce.sh Purchases, revenue, average order value --currency RUB|USD|EUR; auto from counter_info
direct_clients.sh Yandex Direct logins -
direct_costs.sh Yandex Direct costs (ym:ad:*) --direct-client-logins "login"; no --group/--device/--source
comparison.sh Period comparison --date1a/--date2a/--date1b/--date2b; --dimension, --metrics

Not all scripts support all common parameters - see Special params.

Common report script parameters

Param Required Default Values
--counter yes - Counter ID
--date1 yes - YYYY-MM-DD
--date2 no today YYYY-MM-DD
--group no - day, week, month
--device no all desktop, mobile, tablet
--source no all organic, ad, referral, direct, social
--attribution no lastsign lastsign, last, first
--limit no API default number of rows
--csv no - export path
--no-cache no - skip cache

Cache strategy

Cache is stored in cache/:

  • counters.json + counters.tsv - all counters
  • counter_<id>/info.json - metadata (permanent)
  • counter_<id>/goals.json + goals.tsv - goals
  • counter_<id>/config.json - attribution, conversion goals
  • counter_<id>/direct_clients.json - Direct logins
  • counter_<id>/reports/*.csv - report results

To search cache: grep "text" cache/counters.tsv or rg "text" cache/.

Advanced scenarios

API limits

  • Reporting API: ~200 requests / 5 minutes (if exceeded - wait ~5 minutes)
  • Scripts automatically handle 429 (Retry-After ≤ 60s → retry, otherwise fail with message)

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.