skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
elsvv/yandex-metrica-skill103 installs

yandex-metrica

Работа с Yandex Metrica API: аналитика, отчёты, цели, логи. Use when the user needs web analytics data from Yandex Metrica — traffic stats, conversion reports, goal management, raw log exports, counter management, segments, filters, or grants. Triggers: метрика, metrica, аналитика, счётчик, визиты, конверсии, отчёт по трафику, источники трафика, Logs API, экспорт логов.

How do I install this agent skill?

npx skills add https://github.com/elsvv/yandex-metrica-skill --skill yandex-metrica
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    This skill consists of a suite of Bash scripts designed to interact with the Yandex Metrica API for web analytics. It facilitates tasks such as fetching traffic statistics, managing counters, and exporting raw logs. The skill handles authentication securely by utilizing OAuth tokens stored in a local environment configuration file and relies on standard system utilities for its operations. No malicious patterns, obfuscation, or safety violations were detected during the analysis.

  • Socketpass

    No alerts

  • Snykwarn

    Risk: MEDIUM · No issues

  • Runlayerwarn

    13/13 files flagged

What does this agent skill do?

yandex-metrica

Yandex Metrica API — web analytics: counters, reports, goals, logs export.

Config

Requires YANDEX_METRICA_TOKEN in config/.env. See config/README.md for token setup (OAuth, permissions: metrika:read, metrika:write).

Quick Start

IMPORTANT: Always run scripts with bash prefix and absolute paths from the skill directory. Scripts use bash-specific features and will not work if sourced from zsh. Do NOT source scripts/common.sh directly — use the wrapper scripts below.

# 1. Setup token
bash scripts/get_token.sh --client-id YOUR_CLIENT_ID

# 2. Check connection
bash scripts/check_connection.sh

# 3. List counters
bash scripts/counters.sh --action list

# 4. Get traffic stats
bash scripts/stats.sh --counter 12345678 --preset traffic

# 5. Export raw logs
bash scripts/logs.sh --action create --counter 12345678 --date1 2025-01-01 --date2 2025-01-31

API Overview

Base URL: https://api-metrika.yandex.net

Auth header: Authorization: OAuth TOKEN

APIPurposeBase Path
ManagementCounters, goals, filters, grants, segments/management/v1/
ReportingAggregated stats, dimensions, metrics/stat/v1/
LogsRaw visit/hit data export/management/v1/counter/{id}/logrequests

Scripts

check_connection.sh

Verify API token and list available counters.

bash scripts/check_connection.sh

counters.sh

Manage counters: list, get details, get full info with goals/filters.

bash scripts/counters.sh --action list
bash scripts/counters.sh --action list --search "mysite.com"
bash scripts/counters.sh --action info --counter 12345678

stats.sh

Pull reporting data with presets or custom metrics/dimensions.

# Traffic overview
bash scripts/stats.sh --counter 12345678 --preset traffic

# Traffic sources breakdown
bash scripts/stats.sh --counter 12345678 --preset sources

# Top pages
bash scripts/stats.sh --counter 12345678 --preset content

# Custom report with filters
bash scripts/stats.sh --counter 12345678 \
  --metrics "ym:s:visits,ym:s:users,ym:s:bounceRate" \
  --dimensions "ym:s:lastTrafficSource" \
  --filters "ym:s:trafficSource=='organic'" \
  --date1 2025-01-01 --date2 2025-01-31

# Time-series report
bash scripts/stats.sh --counter 12345678 --type bytime \
  --metrics "ym:s:visits" --date1 2025-01-01 --date2 2025-01-31

# Export to CSV
bash scripts/stats.sh --counter 12345678 --preset sources --csv report.csv
ParamDefaultDescription
--counterenv varCounter ID (required)
--metricsvisits,pageviews,usersComma-separated metrics
--dimensions—Comma-separated dimensions
--date130 days agoStart date YYYY-MM-DD
--date2todayEnd date YYYY-MM-DD
--filters—Filter expression
--sort—Sort field (prefix - for desc)
--limit100Max rows
--preset—traffic, sources, geo, content, technology
--typedatadata, bytime, drilldown, comparison
--csv—Export to CSV file

goals.sh

List and get goals for a counter.

bash scripts/goals.sh --action list --counter 12345678
bash scripts/goals.sh --action get --counter 12345678 --goal-id 999

logs.sh

Raw data export via Logs API.

# Check if export is possible
bash scripts/logs.sh --action evaluate --counter 12345678 \
  --date1 2025-01-01 --date2 2025-01-31

# Create log request
bash scripts/logs.sh --action create --counter 12345678 \
  --source visits --date1 2025-01-01 --date2 2025-01-31

# Check status
bash scripts/logs.sh --action status --counter 12345678 --request-id 777

# Download when ready
bash scripts/logs.sh --action download --counter 12345678 \
  --request-id 777 --output ./exports

# Clean up server-side
bash scripts/logs.sh --action clean --counter 12345678 --request-id 777

# List all log requests
bash scripts/logs.sh --action list --counter 12345678

Key Metrics Quick Reference

MetricDescription
ym:s:visitsSessions
ym:s:usersUnique visitors
ym:s:pageviewsTotal pageviews
ym:s:bounceRateBounce rate %
ym:s:avgVisitDurationSecondsAvg session duration
ym:s:newUsersNew visitors
ym:s:goal<ID>reachesGoal completions
ym:s:goal<ID>conversionRateGoal conversion rate
ym:s:ecommerceRevenueE-commerce revenue

Key Dimensions Quick Reference

DimensionDescription
ym:s:trafficSourceTraffic source type
ym:s:lastTrafficSourceLast traffic source
ym:s:<attr>UTMSourceUTM source
ym:s:<attr>UTMMediumUTM medium
ym:s:startURLLanding page
ym:s:regionCountryCountry
ym:s:regionCityCity
ym:s:browserBrowser
ym:s:deviceCategoryDevice type
ym:s:operatingSystemOS

<attr> = attribution model: last, first, lastsign, etc.

Filter Syntax

ym:s:trafficSource=='organic'           # equals
ym:s:trafficSource!='organic'           # not equals
ym:s:trafficSource=.('organic','direct') # in list
ym:s:pageViews>5                        # greater than
ym:s:startURL=@'product'               # contains
ym:s:startURL=~'.*product.*'           # regex
ym:s:trafficSource=='organic' AND ym:s:isRobot=='No'  # combine

Rate Limits

LimitValue
General API30 req/sec per IP
Logs API10 req/sec per IP
Parallel requests3 per user
Daily limit5,000 req/day
Reports API200 req/5 min

Detailed Reference

For comprehensive API documentation including all endpoints, field lists, curl examples, and advanced features, see: references/api-reference.md

Covers: Management API (counters, goals, filters, operations, grants, labels, segments, user params), Reporting API (data, bytime, drilldown, comparison, presets, full metrics/dimensions), Logs API (visits/hits fields).

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/elsvv/yandex-metrica-skill/yandex-metrica">View yandex-metrica on skillZs</a>