Event tracking для аналитика

Карьерник — квиз-тренажёр в Telegram с 1500+ вопросами для собесов аналитика. SQL, Python, A/B, метрики. Бесплатно.

Зачем это знать

Без tracking — нет аналитики продукта. «Мы не знаем, нажимают ли на кнопку». Event tracking — foundation product analytics.

Analyst — часто designs, owns tracking plan. На собесах могут спросить.

Что такое event

Action пользователя или system:

  • User click button
  • Page view
  • Purchase
  • Error occurred
  • Video watched 10 seconds

Captured с properties (context).

Event structure

Standard

{
  "event_name": "product_viewed",
  "user_id": "u_123",
  "timestamp": "2026-04-23T10:30:00Z",
  "properties": {
    "product_id": "p_456",
    "category": "electronics",
    "price": 1000
  },
  "context": {
    "device": "iPhone",
    "os_version": "17.0",
    "app_version": "2.3.1",
    "country": "RU"
  }
}

Типы событий

Identify

Link user к session:

identify(user_id, {email, plan, ...})

Track

Action performed:

track('product_viewed', {product_id, ...})

Page / screen

page('/products/iphone')
screen('Product Detail')

Group (B2B)

User part of organization:

group(org_id, {org_name, plan})

Tracking plan

Document of what trackable.

Columns

  • Event name
  • Description
  • Required / optional properties
  • Owner
  • Use case

Example

Event Description Properties
product_viewed User views product product_id, category, price
added_to_cart Item added product_id, quantity
checkout_started Checkout form opened cart_total
purchase_completed Order placed order_id, amount, items

Naming conventions

Consistent

Pick format:

  • snake_case (most common)
  • camelCase
  • Consistent verb tense

Verb + noun

  • product_viewed (past)
  • order_placed

Not click_product_button — too implementation-specific.

Event vs property

Event = action. Property = detail about action.

  • Event: video_played
  • Property: video_duration, video_category

Properties

User properties

Attached к user profile:

  • signup_date
  • plan
  • email
  • lifetime_value

Updated периодически.

Event properties

Specific к event:

  • product_id
  • amount
  • session_duration

Context

Device, platform, app version. Usually auto-captured.

Tools

SDK

  • Amplitude SDK
  • Segment
  • Mixpanel SDK
  • PostHog
  • Google Analytics 4

Server-side

Для reliability (adblock не affect):

analytics.track('purchase_completed', properties={...})

Hybrid

Client для UX events, server для critical (payments).

Implementation

Client-side

// React example
import { track } from './analytics';

function onAddToCart(product) {
    track('added_to_cart', {
        product_id: product.id,
        price: product.price
    });
}

Server-side

# After DB transaction
analytics.track(
    user_id=user.id,
    event='purchase_completed',
    properties={
        'order_id': order.id,
        'amount': order.total
    }
)

Pitfalls

  • Missing events (bug, adblock)
  • Duplicate events (retry logic)
  • Wrong user_id (not logged in)
  • Privacy (PII в events)

Data quality

Testing

  • QA each new event
  • Verify в test environment
  • Check production regularly

Monitoring

  • Event volume alerts (drop)
  • Property completeness
  • Schema compliance

Validation

Tools: Segment Protocols, Iteratively.

User identification

Anonymous

Pre-signup users. Device / session ID.

Merge

When signs up → link anonymous events к user_id.

«Merge» operation critical. Lose pre-signup funnel без.

Privacy

PII

Don't put names, emails, phones в event properties plain text.

Hash or ID reference.

Consent

GDPR, Russian ФЗ-152 — user must consent tracking.

Cookie banners, consent UI.

Anonymization

Older data — anonymize.

Real-time vs batch

Real-time

Events fire → immediately в analytics.

Good для monitoring, alerts.

Batch

Collected → sent периодически.

Efficient bandwidth.

Streaming platforms

Kafka, Kinesis — event stream. Analytics consumes.

Использование

Product analytics

Amplitude / Mixpanel — funnels, retention.

Data warehouse

Events + enrichment → DWH. SQL queries.

Marketing

Attribution, retargeting.

Engineering

Debug issues, error tracking.

Common mistakes

Tracking all, analyzing nothing

Over-track → overwhelming.

Focus: what questions want answered?

Bad names

button_clicked_on_screen_4_v2_new — unreadable.

Clear, semantic names.

No documentation

Team adds events ad-hoc. Confusion.

Maintain tracking plan.

Missing properties

«I want break down by X, но X not в properties». Missing opportunity.

Include key properties upfront.

Inconsistent

Two events doing same thing. Merge.

В companies

Russian

  • Яндекс Метрика (free), AppMetrica
  • MyTracker (Mail.ru для games)
  • Alchemy / internal tools

International

  • Amplitude
  • Mixpanel
  • PostHog
  • Segment (aggregator)

Data model

Warehouse tables:

-- Events raw
(event_id, user_id, event_name, TIMESTAMP, properties_json, context_json)

-- User properties (current)
(user_id, plan, signup_date, ...)

-- Event schema registry
(event_name, property_name, type, required)

SQL query examples

Count events per type

SELECT event_name, COUNT(*) FROM events
WHERE TIMESTAMP >= CURRENT_DATE - 1
GROUP BY 1 ORDER BY 2 DESC;

Funnel

See SQL для воронок.

Drilldown properties

SELECT
    properties_json->>'category' AS category,
    COUNT(*) AS events
FROM events
WHERE event_name = 'product_viewed'
GROUP BY 1;

На собесе

«How instrument product tracking?»

Process:

  1. Identify key user journeys
  2. Define events per journey
  3. Document tracking plan
  4. Implement SDK / server-side
  5. QA
  6. Release
  7. Monitor

«Pitfalls?»

Missing events, bad names, PII leakage, identification gaps.

Связанные темы

FAQ

Сколько events?

Quality > quantity. 20-50 typical core events.

Real-time нужен?

Обычно batch OK. Real-time — specific use cases.

Tools ok без analytics platform?

SQL + warehouse. Works. Requires more engineering.


Тренируйте — откройте тренажёр с 1500+ вопросами для собесов.