Analytics dashboard

From abcnuts/manus-skills · View interactive version

Analytics dashboard is an AI agent skill from the GitHub repository abcnuts/manus-skills. User behavior tracking and analytics dashboards

How to use this skill

Skill file

Analytics Dashboard Skill

Automate setup of analytics tracking and dashboard generation for web applications.


Purpose

This skill helps you implement comprehensive analytics tracking and create beautiful dashboards to understand user behavior, track conversions, and measure product success.


When to Use


What It Does

  1. Detects project type (Next.js, React, Express, Python)
  2. Installs analytics dependencies (PostHog, Mixpanel, Amplitude, Segment)
  3. Creates analytics configuration with initialization code
  4. Generates dashboard components with key metrics
  5. Provides tracking patterns for common events
  6. Includes best practices for performance and privacy

Quick Start

1. Run Setup Script

python3 /home/ubuntu/skills/analytics-dashboard/scripts/setup_analytics.py \
  /path/to/your/project \
  posthog \
  YOUR_API_KEY

Arguments:


2. Initialize Analytics

Next.js - Add to app/layout.tsx:

import { initAnalytics } from '@/lib/analytics'

export default function RootLayout({ children }) {
  useEffect(() => {
    initAnalytics()
  }, [])
  
  return <html>{children}</html>
}

Python/Flask - Add to app initialization:

from analytics import track_event, identify_user

@app.before_request
def track_page_view():
    if current_user.is_authenticated:
        track_event(current_user.id, 'page_view', {
            'path': request.path
        })

3. Track Events

import { trackEvent } from '@/lib/analytics'

// Track button click
<button onClick={() => trackEvent('signup_clicked', {
  location: 'homepage'
})}>
  Sign Up
</button>

// Track form submission
const handleSubmit = (data) => {
  trackEvent('form_submitted', {
    form_name: 'contact',
    fields: Object.keys(data)
  })
}

// Track conversion
trackEvent('purchase_completed', {
  amount: 99.99,
  currency: 'USD',
  items: 3
})

4. Add Dashboard

Copy the generated dashboard component:

cp /home/ubuntu/skills/analytics-dashboard/templates/dashboard.tsx \
   /path/to/your/project/components/

Use in your app:

import AnalyticsDashboard from '@/components/AnalyticsDashboard'

export default function AdminPage() {
  return <AnalyticsDashboard />
}

Supported Providers

PostHog (Recommended)

Mixpanel

Amplitude

Segment


Key Metrics to Track

Engagement

Conversion

Retention

Product


Event Tracking Patterns

Page Views

useEffect(() => {
  trackEvent('page_view', {
    path: window.location.pathname,
    referrer: document.referrer
  })
}, [pathname])

User Actions

trackEvent('button_clicked', {
  button_name: 'signup',
  location: 'homepage_hero'
})

User Identification

identifyUser(user.id, {
  email: user.email,
  plan: user.subscription_plan,
  signup_date: user.created_at
})

Conversions

trackEvent('purchase_completed', {
  amount: total,
  currency: 'USD',
  payment_method: 'stripe'
})

Dashboard Components

The generated dashboard includes:

  1. Key Metrics Cards
  1. Charts
  1. Tables

Best Practices

Performance

Privacy

Data Quality


Files Generated

Scripts

Templates

References


Workflow

  1. Setup → Run script to install and configure
  2. Initialize → Add analytics to app entry point
  3. Track → Add event tracking throughout app
  4. Dashboard → Add dashboard component for viewing
  5. Optimize → Refine based on data

Examples

E-commerce Site

// Product viewed
trackEvent('product_viewed', {
  product_id: product.id,
  category: product.category,
  price: product.price
})

// Added to cart
trackEvent('add_to_cart', {
  product_id: product.id,
  quantity: 1,
  cart_total: cart.total
})

// Purchase completed
trackEvent('purchase_completed', {
  order_id: order.id,
  total: order.total,
  items: order.items.length
})

SaaS Application

// Trial started
trackEvent('trial_started', {
  plan: 'pro',
  trial_days: 14
})

// Feature used
trackEvent('feature_used', {
  feature_name: 'export_data',
  usage_count: user.export_count
})

// Subscription upgraded
trackEvent('subscription_upgraded', {
  from_plan: 'basic',
  to_plan: 'pro',
  mrr_change: 20
})

Troubleshooting

Events not showing up

Dashboard not loading

Performance issues


Time Savings

Manual Setup: 2-3 hours

With This Skill: 15-20 minutes

Time Saved: ~2 hours per project


Related Skills


Resources


Built with best practices, privacy-conscious, performance-optimized.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.