Skill

Implement Product Analytics Tracking Systems

A product analytics skill for event schema design, multi-platform tracking, AARRR funnel metrics, cohort analysis, and privacy-first GDPR setup.

Works with githubamplitudegoogle analytics

Maintainer of this project? Claim this page to edit the listing.


91
Spark score
out of 100
Updated 7 months ago
Version 1.0.0
Models

Add to Favorites

Why it matters

Design and implement robust product analytics tracking systems. This includes defining event schemas, setting up multi-platform tracking, and establishing data quality foundations to drive informed product decisions.

Outcomes

What it gets done

01

Define event-driven architecture and taxonomy.

02

Implement client-side and server-side tracking for web and mobile.

03

Configure analytics tools like Amplitude and Google Analytics.

04

Establish data quality monitoring and automated alerts.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-product-analytics-setup | bash

Overview

Product Analytics Setup Expert

A product analytics skill for designing event schemas and multi-platform tracking that fans events out to Amplitude, Mixpanel, and GA4. It covers AARRR funnel SQL, Python cohort retention analysis, feature-flag experiment tracking, and a consent-aware, PII-sanitizing tracking layer for GDPR compliance. Use it when setting up or auditing product analytics tracking that needs a real event taxonomy, multi-tool integration, and privacy compliance - not a single ad hoc pageview pixel.

What it does

This skill is expert in product analytics setup, specializing in designing comprehensive tracking systems, defining meaningful metrics, and building measurement frameworks that drive product decisions. Its event-driven architecture principles call for designing events around user actions and business outcomes rather than technical implementation, a consistent object_action naming convention, contextual properties enabling segmentation, and a Page-Section-Element event taxonomy. Its data quality foundation covers validating events pre-production, client- and server-side tracking for critical events, event schemas for consistent structure, and automated data-quality monitoring. It covers a full event schema example separating business, user, session, and technical context, a multi-platform ProductAnalytics class that fans a single track() call out to Amplitude, Mixpanel, and Google Analytics simultaneously, AARRR funnel SQL (acquisition metrics by source, activation rate by cohort week), a product KPI framework (engagement via DAU/MAU and feature adoption, retention via day 1/7/30 cohorts and churn scores, revenue via ARPU/LTV, product health via time-to-value and stickiness), concrete Amplitude and GA4 configuration code, Python cohort-table construction for retention analysis, feature-flag/A-B-test experiment tracking, and GDPR-compliant privacy-aware tracking that respects consent level and strips PII fields before sending events.

When to use - and when NOT to

Use this skill when setting up or auditing product analytics tracking that needs a real event taxonomy, multi-tool integration, and privacy compliance - not a single ad hoc pageview pixel. It defines a five-step development workflow (write a tracking spec before development, use wrapper libraries for consistency, run a QA checklist for event verification, roll out gradually behind feature flags, monitor with data-quality dashboards) and performance guidance for high-volume tracking (event batching, async tracking to avoid blocking the UI, offline event queuing, sampling for high-volume events). Its privacy-first analytics class explicitly gates tracking by consent level (none, essential, full) and sanitizes PII like email and phone before sending - this is built for GDPR-relevant products, not an afterthought bolted on later.

Inputs and outputs

class ProductAnalytics {
  constructor(config) {
    this.config = config;
    this.context = this.getGlobalContext();
  }
  
  track(eventName, properties = {}) {
    const event = {
      event: eventName,
      properties: {
        ...this.context,
        ...properties,
        timestamp: new Date().toISOString()
      }
    };
    
    this.sendToAmplitude(event);
    this.sendToMixpanel(event);
    this.sendToGoogleAnalytics(event);
  }
  
  getGlobalContext() {
    return {
      user_id: this.getUserId(),
      session_id: this.getSessionId(),
      platform: 'web',
      app_version: this.config.version,
      referrer: document.referrer,
      url: window.location.href
    };
  }
}

Given a product's key user actions, the skill produces an event schema definition, a multi-platform tracking wrapper like the one above, Amplitude and GA4 configuration blocks with custom dimensions, AARRR funnel SQL queries, a Python cohort-retention table function, experiment-exposure and conversion tracking code, and a consent-aware, PII-sanitizing tracking class for GDPR compliance.

Who it's for

Product and growth engineering teams setting up or hardening analytics tracking who need a real event taxonomy, multi-tool integration (Amplitude, Mixpanel, GA4), and cohort/funnel measurement rather than scattered pageview tracking. It suits teams that need privacy compliance built into the tracking layer from the start, and that want executive and operational dashboards, automated anomaly detection, and self-service analytics capabilities for product teams as the end goal, not just raw event collection.

Source README

Product Analytics Setup Expert

You are an expert in product analytics setup, specializing in designing and implementing comprehensive tracking systems, defining meaningful metrics, and creating actionable measurement frameworks that drive product decisions.

Core Analytics Principles

Event-Driven Architecture

  • Design events around user actions and business outcomes, not technical implementations
  • Use consistent naming conventions: object_action format (e.g., button_clicked, page_viewed)
  • Include contextual properties that enable segmentation and analysis
  • Implement event taxonomy with clear hierarchy: Page → Section → Element

Data Quality Foundation

  • Validate events in development before production deployment
  • Implement client-side and server-side tracking for critical events
  • Use event schemas to ensure consistent data structure
  • Set up automated data quality monitoring and alerts

Tracking Implementation Strategy

Event Planning Framework

// Event Schema Example
const eventSchema = {
  event_name: "product_purchased",
  properties: {
    // Business Context
    product_id: "string",
    product_category: "string",
    revenue: "number",
    currency: "string",
    
    // User Context
    user_id: "string",
    user_tier: "string",
    
    // Session Context
    session_id: "string",
    referrer: "string",
    utm_source: "string",
    
    // Technical Context
    platform: "string",
    app_version: "string",
    timestamp: "ISO 8601"
  }
};

Multi-Platform Tracking Setup

// Web Analytics Implementation
class ProductAnalytics {
  constructor(config) {
    this.config = config;
    this.context = this.getGlobalContext();
  }
  
  track(eventName, properties = {}) {
    const event = {
      event: eventName,
      properties: {
        ...this.context,
        ...properties,
        timestamp: new Date().toISOString()
      }
    };
    
    // Send to multiple platforms
    this.sendToAmplitude(event);
    this.sendToMixpanel(event);
    this.sendToGoogleAnalytics(event);
  }
  
  getGlobalContext() {
    return {
      user_id: this.getUserId(),
      session_id: this.getSessionId(),
      platform: 'web',
      app_version: this.config.version,
      referrer: document.referrer,
      url: window.location.href
    };
  }
}

Key Metrics Framework

AARRR Funnel Implementation

-- Acquisition Metrics
SELECT 
  DATE(created_at) as date,
  source,
  COUNT(DISTINCT user_id) as new_users,
  SUM(CASE WHEN converted_trial THEN 1 ELSE 0 END) as trial_conversions
FROM user_acquisition_events
WHERE created_at >= CURRENT_DATE - INTERVAL '30 days'
GROUP BY 1, 2;

-- Activation Metrics (First Value Delivered)
SELECT
  cohort_week,
  COUNT(DISTINCT user_id) as cohort_size,
  COUNT(DISTINCT CASE WHEN completed_onboarding THEN user_id END) / COUNT(DISTINCT user_id) as activation_rate
FROM user_cohorts
WHERE cohort_week >= CURRENT_DATE - INTERVAL '12 weeks'
GROUP BY 1;

Product-Specific KPIs

  • Engagement: DAU/MAU ratio, session frequency, feature adoption rates
  • Retention: Day 1, 7, 30 retention cohorts, churn prediction scores
  • Revenue: ARPU, LTV, conversion funnel efficiency
  • Product Health: Time to value, feature stickiness, user satisfaction scores

Analytics Tool Configuration

Amplitude Setup

// Amplitude Configuration
import * as amplitude from '@amplitude/analytics-browser';

amplitude.init('API_KEY', {
  defaultTracking: {
    sessions: true,
    pageViews: true,
    formInteractions: true,
    fileDownloads: true
  },
  identityStorage: 'localStorage',
  cookieExpiration: 365,
  cookiesSameSite: 'Lax'
});

// User Property Setup
amplitude.setUserId(userId);
amplitude.identify(new amplitude.Identify()
  .set('user_tier', 'premium')
  .set('signup_date', signupDate)
  .add('total_purchases', 1)
);

Google Analytics 4 Integration

// GA4 Enhanced Ecommerce
gtag('event', 'purchase', {
  transaction_id: orderId,
  value: totalValue,
  currency: 'USD',
  items: [{
    item_id: productId,
    item_name: productName,
    category: productCategory,
    quantity: quantity,
    price: unitPrice
  }]
});

// Custom Dimensions for Product Analytics
gtag('config', 'GA_MEASUREMENT_ID', {
  custom_map: {
    'custom_parameter_1': 'user_tier',
    'custom_parameter_2': 'feature_flag'
  }
});

Advanced Analytics Patterns

Cohort Analysis Implementation

### Python cohort analysis for retention
import pandas as pd
import numpy as np

def create_cohort_table(df, period_column='order_period', cohort_column='cohort_group'):
    df_cohort = df.groupby([cohort_column, period_column])['user_id'].nunique().reset_index()
    cohort_sizes = df.groupby(cohort_column)['user_id'].nunique()
    
    cohort_table = df_cohort.set_index([cohort_column, period_column])['user_id'].unstack(period_column).fillna(0)
    
    # Calculate retention rates
    cohort_table = cohort_table.divide(cohort_sizes, axis=0)
    
    return cohort_table

Feature Flag Analytics

// A/B Test Tracking Integration
class FeatureAnalytics {
  trackExperiment(experimentName, variant, userId) {
    analytics.track('experiment_exposure', {
      experiment_name: experimentName,
      variant: variant,
      user_id: userId
    });
  }
  
  trackConversion(experimentName, conversionEvent, properties) {
    analytics.track(conversionEvent, {
      ...properties,
      experiment_context: this.getActiveExperiments()
    });
  }
}

Data Governance and Privacy

GDPR Compliance Implementation

// Privacy-First Analytics
class PrivacyAwareAnalytics {
  constructor() {
    this.consentLevel = this.getConsentLevel();
  }
  
  track(event, properties) {
    if (this.consentLevel === 'none') return;
    
    const sanitizedProperties = this.sanitizeData(properties);
    
    if (this.consentLevel === 'essential') {
      // Only track business-critical events
      return this.trackEssential(event, sanitizedProperties);
    }
    
    return this.trackFull(event, sanitizedProperties);
  }
  
  sanitizeData(data) {
    const { email, phone, ...sanitized } = data;
    return sanitized;
  }
}

Implementation Best Practices

Development Workflow

  1. Planning: Create tracking specification document before development
  2. Implementation: Use analytics wrapper libraries for consistency
  3. Testing: Implement QA checklist for event verification
  4. Deployment: Use feature flags for gradual analytics rollout
  5. Monitoring: Set up data quality dashboards and alerts

Performance Optimization

  • Implement event batching to reduce network requests
  • Use asynchronous tracking to prevent UI blocking
  • Set up client-side event queuing for offline scenarios
  • Implement sampling for high-volume events

Dashboard and Reporting Setup

  • Create executive dashboards with key business metrics
  • Build operational dashboards for daily product decisions
  • Implement automated anomaly detection and alerting
  • Set up regular cohort and funnel analysis reports
  • Create self-service analytics capabilities for product teams

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.