Communitygithub.com

Umami:网站分析技能

使用 Umami 追踪网站分析数据——这是一款注重隐私、开源的 Google Analytics 替代方案。适用于用户要求“追踪网站分析”、“Umami”、“隐私友好型分析”、“自托管分析”、“GDPR 分析”、“替代 Google Analytics”或“无需 cookie 的网站流量追踪”等场景。涵盖设置、事件追踪、自定义属性、API 和自托管。

Umami:网站分析技能 是什么?

Umami 是注重隐私的网站分析工具,无需 Cookie 或收集个人数据即可追踪页面浏览、访客和自定义事件,默认符合 GDPR/CCPA 法规,无需同意横幅。支持自托管(Docker、Vercel 等)或通过 Umami Cloud 托管,提供简洁的实时数据面板和程序化 API 接口,是开源社区公认的 Google Analytics 替代方案。该技能详细指导如何在各类项目(如 Next.js)中集成跟踪脚本、使用自定义事件追踪用户行为(点击、表单提交等),以及通过 API 获取分析数据构建内部面板。支持多站点管理、UTM 跟踪和轻量级脚本(<2KB),后端可选择 PostgreSQL 或 MySQL 数据库。此技能适用于 Claude Code、Cursor、Codex 等 AI 助手,帮助开发者快速实现隐私合规的网站分析。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/TerminalSkills/skills/tree/HEAD/skills/umami

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Umami

概述

Umami 是一个注重隐私的网站分析平台——无需 Cookie 或收集个人数据即可追踪页面浏览量、访客和自定义事件。默认符合 GDPR/CCPA 标准(无需同意横幅)。可在您自己的基础设施上自托管,也可使用 Umami Cloud。提供简洁面板、实时数据以及程序化 API 访问。是排名第一的开源 Google Analytics 替代方案。

使用场景

  • 需要网站分析,但无需 Cookie 同意横幅
  • GDPR/CCPA 合规是强制要求
  • 不信任 Google 处理您的分析数据
  • 希望在自有基础设施上自托管分析
  • 想要简单、清晰的分析,避免 GA4 的复杂性
  • 需要通过 API 访问分析数据,用于面板/报告

使用说明

自托管设置

# Docker Compose
git clone https://github.com/umami-software/umami.git
cd umami
docker compose up -d

# 或者一键部署到 Vercel/Netlify/Railway
# 参见:https://umami.is/docs/install

添加跟踪脚本

<!-- 添加到您网站的 <head> 中 -->
<script
  defer
  src="https://analytics.mysite.com/script.js"
  data-website-id="your-website-id"
></script>
// Next.js — app/layout.tsx
import Script from "next/script";

export default function RootLayout({ children }) {
  return (
    <html>
      <head>
        <Script
          defer
          src="https://analytics.mysite.com/script.js"
          data-website-id="your-website-id"
        />
      </head>
      <body>{children}</body>
    </html>
  );
}

自定义事件追踪

// 追踪自定义事件
// Umami 暴露了一个全局的 `umami` 对象

// 追踪按钮点击
document.getElementById("signup-btn")?.addEventListener("click", () => {
  umami.track("signup-click", { plan: "pro", source: "header" });
});

// 追踪表单提交
function handleSubmit(formData: FormData) {
  umami.track("form-submit", {
    form: "contact",
    subject: formData.get("subject"),
  });
}

// 在 React 中追踪
function PricingCard({ plan }: { plan: string }) {
  return (
    <button
      onClick={() => umami.track("pricing-click", { plan })}
      data-umami-event="pricing-click"
      data-umami-event-plan={plan}
    >
      选择 {plan}
    </button>
  );
}

API 访问

// api/analytics.ts — 以编程方式获取分析数据
const UMAMI_URL = "https://analytics.mysite.com";
const UMAMI_TOKEN = process.env.UMAMI_API_TOKEN;

async function getPageViews(websiteId: string, days = 30) {
  const endDate = Date.now();
  const startDate = endDate - days * 24 * 60 * 60 * 1000;

  const res = await fetch(
    `${UMAMI_URL}/api/websites/${websiteId}/pageviews?startAt=${startDate}&endAt=${endDate}&unit=day`,
    { headers: { Authorization: `Bearer ${UMAMI_TOKEN}` } }
  );
  return res.json();
}

async function getTopPages(websiteId: string) {
  const endDate = Date.now();
  const startDate = endDate - 7 * 24 * 60 * 60 * 1000;

  const res = await fetch(
    `${UMAMI_URL}/api/websites/${websiteId}/metrics?startAt=${startDate}&endAt=${endDate}&type=url`,
    { headers: { Authorization: `Bearer ${UMAMI_TOKEN}` } }
  );
  return res.json();  // [{ x: "/pricing", y: 1234 }, ...]
}

示例

示例 1:为 SaaS 添加隐私友好分析

用户提示:“为我们的 SaaS 添加分析功能,无需 Cookie 或同意横幅。”

智能体将部署 Umami,添加跟踪脚本,为关键操作(注册、升级、功能使用)设置自定义事件,并创建用于内部面板的 API 集成。

示例 2:构建自定义分析面板

用户提示:“将我们的 Umami 数据拉取到自定义面板中,供市场团队使用。”

智能体将使用 Umami API 获取页面浏览量、热门页面、引荐来源和事件,然后在 React 面板中展示。

指南

  • 无 Cookie = 无需同意横幅 — 默认符合 GDPR
  • data-umami-event 属性 — 无需 JavaScript 即可追踪点击
  • umami.track(name, data) 用于自定义事件 — 灵活的事件追踪
  • 自托管以实现完全控制 — Docker、Vercel、Railway 或任何 Node.js 托管平台
  • API 提供程序化访问 — 构建自定义面板和报告
  • 多站点支持 — 一个 Umami 实例可追踪多个网站
  • 实时面板 — 立即查看当前活跃访客
  • UTM 跟踪 — 活动归因自动生效
  • 轻量级脚本 — 小于 2KB,不会拖慢您的网站
  • PostgreSQL 或 MySQL — 您可以选择后端数据库

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

TerminalSkills/skills

>- Run GitHub Actions locally with act. Use when a user asks to test GitHub Actions workflows locally, debug CI pipelines without pushing, or run workflows offline.

TerminalSkills/skills

>- You are an expert in AG2 (formerly AutoGen), the open-source multi-agent conversation framework. You help developers build systems where multiple AI agents collaborate through structured conversations — with tool use, human-in-the-loop, code execution, group chat orchestration, and nested conversations — for complex tasks like software development, research, and data analysis.

TerminalSkills/skills

>- Generate short-form videos with AI — script writing, text-to-speech narration, stock footage selection, subtitle generation, and video assembly. Use when: creating TikTok/YouTube Shorts/Reels content, automating video production, building content pipelines.

TerminalSkills/skills

>- Animate 3D objects and characters in Blender with Python. Use when the user wants to keyframe properties, create armatures and rigs, set up IK/FK chains, animate shape keys for facial animation, edit F-Curves, use the NLA editor to blend actions, add drivers for expression-based animation, or script any animation workflow in Blender.

TerminalSkills/skills

>- Automate motion capture and tracking workflows in Blender with Python. Use when the user wants to import BVH or FBX mocap data, retarget motion to armatures, track camera or object motion from video, solve camera motion, clean up motion capture data, or script any tracking pipeline in Blender.

TerminalSkills/skills

>- You are an expert in Bolt.new by StackBlitz, the AI-powered full-stack development environment that runs entirely in the browser. You help developers go from idea to deployed app in minutes using natural language prompts — Bolt generates complete applications with frontend, backend, database, and deployment, all running in a WebContainer without local setup.

TerminalSkills/skills

>- Assists with using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building HTTP servers, managing packages, running tests, or migrating from Node.js. Trigger words: bun, bun serve, bun install, bun test, bun build, javascript runtime, bun runtime.

TerminalSkills/skills

>- Self-host customer support with Chatwoot. Use when a user asks to set up open-source customer support, add live chat without SaaS costs, build a multi-channel inbox, or deploy a free Intercom alternative.

TerminalSkills/skills

>- You are an expert in Chi, the lightweight, idiomatic Go HTTP router built on `net/http`. You help developers build composable HTTP services using Chi's middleware stack, route groups, URL parameters, sub-routers, and context-based request scoping — providing Express-like ergonomics while staying 100% compatible with Go's standard library.

TerminalSkills/skills

When the user wants to edit, review, or improve existing marketing copy. Also use when the user mentions 'edit this copy,' 'review my copy,' 'copy feedback,' 'proofread,' 'polish this,' 'make this better,' or 'copy sweep.' This skill provides a systematic approach to editing marketing copy through multiple focused passes.

TerminalSkills/skills

>- Add live chat and customer support with Crisp. Use when a user asks to add a chat widget, implement live customer support, set up a help desk, create a knowledge base, or add a chatbot to a website.

TerminalSkills/skills

>- Assists with building custom interactive data visualizations using D3.js. Use when creating charts, graphs, maps, force layouts, or hierarchical diagrams that require fine-grained control beyond what charting libraries provide. Trigger words: d3, data visualization, chart, svg, scales, force graph, treemap, choropleth.

TerminalSkills/skills

dbt (data build tool) transforms data in your warehouse using SQL SELECT statements. Learn project setup, models, tests, documentation, incremental materializations, and integration with data warehouses like PostgreSQL, BigQuery, and Snowflake.

TerminalSkills/skills

>- You are an expert in dlt, the open-source Python library for building data pipelines. You help developers load data from any API, file, or database into warehouses and lakes using simple Python decorators — with automatic schema inference, incremental loading, and built-in data contracts. dlt is the "requests library for data pipelines.

TerminalSkills/skills

Data Version Control for ML projects. Track large datasets and models alongside Git, build reproducible ML pipelines, and run experiments with metric comparison. Works with any storage backend including S3, GCS, Azure, and local filesystems.

TerminalSkills/skills

>- You are an expert in E2B, the cloud platform for running AI-generated code in secure sandboxes. You help developers give AI agents the ability to execute code, install packages, read/write files, and run long processes in isolated cloud environments — each sandbox is a lightweight VM that boots in ~150ms with full Linux, filesystem, and networking.

TerminalSkills/skills

>- Transcode, convert, edit, and process audio and video with FFmpeg. Use when a user asks to convert video formats (webm to mp4, mkv to mp4), extract audio from video, compress video files, trim or cut clips, concatenate videos, add subtitles, create thumbnails, apply filters, change resolution or bitrate, re-encode media, create GIFs from video, add watermarks, normalize audio, stream media, or build automated media processing pipelines.

TerminalSkills/skills

>- Create advanced animations with GSAP. Use when building complex timelines, scroll-driven animations, SVG morphing, text animations, or high-performance web animations beyond CSS capabilities.

TerminalSkills/skills

>- Generate deterministic MP4 videos from HTML, CSS, media, and seekable animations using HeyGen's HyperFrames framework. Use when someone asks to "render HTML to video", "make a video with HyperFrames", "create a programmatic video", "turn an animation into MP4", "build a launch/product video from HTML", "render GSAP/Lottie/Three.js to video", or set up an agent-driven video pipeline. Covers init/preview/render/add/lint/inspect commands, data-* timing attributes, animation adapters, and the component catalog.

TerminalSkills/skills

When the user wants to perform load testing, stress testing, or performance testing of APIs and websites using k6. Also use when the user mentions "k6," "load test," "performance test," "stress test," "spike test," "soak test," "thresholds," "virtual users," or "VUs." For browser-based testing, see selenium.

相关技能