google-analytics
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoogle Analytics Skill
Google Analytics 技能
Track website and app analytics with Google Analytics 4's comprehensive platform.
借助Google Analytics 4的综合平台追踪网站与应用的分析数据。
Quick Install
快速安装
bash
curl -sSL https://canifi.com/skills/google-analytics/install.sh | bashOr manually:
bash
cp -r skills/google-analytics ~/.canifi/skills/bash
curl -sSL https://canifi.com/skills/google-analytics/install.sh | bash或者手动安装:
bash
cp -r skills/google-analytics ~/.canifi/skills/Setup
设置
Configure via canifi-env:
bash
undefined通过canifi-env进行配置:
bash
undefinedFirst, ensure canifi-env is installed:
首先,确保已安装canifi-env:
curl -sSL https://canifi.com/install.sh | bash
curl -sSL https://canifi.com/install.sh | bash
canifi-env set GOOGLE_ANALYTICS_PROPERTY_ID "your_property_id"
canifi-env set GOOGLE_CLIENT_ID "your_client_id"
canifi-env set GOOGLE_CLIENT_SECRET "your_client_secret"
canifi-env set GOOGLE_REFRESH_TOKEN "your_refresh_token"
undefinedcanifi-env set GOOGLE_ANALYTICS_PROPERTY_ID "your_property_id"
canifi-env set GOOGLE_CLIENT_ID "your_client_id"
canifi-env set GOOGLE_CLIENT_SECRET "your_client_secret"
canifi-env set GOOGLE_REFRESH_TOKEN "your_refresh_token"
undefinedPrivacy & Authentication
隐私与认证
Your credentials, your choice. Canifi LifeOS respects your privacy.
你的凭证,由你掌控。 Canifi LifeOS尊重你的隐私。
Option 1: Manual Browser Login (Recommended)
选项1:手动浏览器登录(推荐)
If you prefer not to share credentials with Claude Code:
- Complete the Browser Automation Setup using CDP mode
- Login to the service manually in the Playwright-controlled Chrome window
- Claude will use your authenticated session without ever seeing your password
如果你不想与Claude Code共享凭证:
- 使用CDP模式完成浏览器自动化设置
- 在Playwright控制的Chrome窗口中手动登录该服务
- Claude将使用你的已认证会话,全程不会获取你的密码
Option 2: Environment Variables
选项2:环境变量
If you're comfortable sharing credentials, you can store them locally:
bash
canifi-env set SERVICE_EMAIL "your-email"
canifi-env set SERVICE_PASSWORD "your-password"Note: Credentials stored in canifi-env are only accessible locally on your machine and are never transmitted.
如果你愿意共享凭证,可以将其存储在本地:
bash
canifi-env set SERVICE_EMAIL "your-email"
canifi-env set SERVICE_PASSWORD "your-password"注意:存储在canifi-env中的凭证仅能在你的本地机器上访问,绝不会被传输。
Capabilities
功能特性
- Traffic Analysis: Monitor website traffic, sources, and user behavior
- Conversion Tracking: Track goals, events, and e-commerce conversions
- Audience Insights: Understand user demographics and interests
- Real-time Data: View live user activity on your properties
- Custom Reports: Create custom reports and explorations
- 流量分析:监控网站流量、来源及用户行为
- 转化追踪:追踪目标、事件及电商转化
- 受众洞察:了解用户的人口统计特征与兴趣偏好
- 实时数据:查看你的属性上的实时用户活动
- 自定义报告:创建自定义报告与探索分析
Usage Examples
使用示例
Get Traffic Overview
获取流量概览
User: "Show me website traffic for the last 7 days"
Assistant: Returns sessions, users, and pageviews用户:“展示过去7天的网站流量数据”
助手:返回会话数、用户数和页面浏览量View Top Pages
查看热门页面
User: "What are my top performing pages?"
Assistant: Returns pages by views and engagement用户:“我表现最好的页面有哪些?”
助手:按浏览量和互动度返回页面列表Check Conversions
查看转化数据
User: "How many conversions did we get this month?"
Assistant: Returns conversion counts by goal用户:“我们这个月有多少转化?”
助手:按目标返回转化数量Real-time Users
实时用户数据
User: "How many users are on the site right now?"
Assistant: Returns real-time user count and activity用户:“现在网站上有多少用户?”
助手:返回实时用户数量及活动情况Authentication Flow
认证流程
- Create project in Google Cloud Console
- Enable Analytics API
- Set up OAuth 2.0 credentials
- Implement authorization code flow
- 在Google Cloud Console中创建项目
- 启用Analytics API
- 设置OAuth 2.0凭证
- 实现授权码流程
Error Handling
错误处理
| Error | Cause | Solution |
|---|---|---|
| 401 Unauthorized | Token expired | Refresh access token |
| 403 Forbidden | No property access | Check permissions |
| 404 Not Found | Invalid property ID | Verify property ID |
| 429 Rate Limited | Quota exceeded | Wait for quota reset |
| 错误 | 原因 | 解决方案 |
|---|---|---|
| 401 Unauthorized | 令牌过期 | 刷新访问令牌 |
| 403 Forbidden | 无属性访问权限 | 检查权限设置 |
| 404 Not Found | 属性ID无效 | 验证属性ID |
| 429 Rate Limited | 配额超出 | 等待配额重置 |
Notes
注意事项
- GA4 is the current version
- Universal Analytics deprecated
- Free tier with data limits
- BigQuery export available
- Custom dimensions supported
- Audience export to Google Ads
- GA4为当前版本
- Universal Analytics已废弃
- 免费版有数据限制
- 支持BigQuery导出
- 支持自定义维度
- 可将受众数据导出至Google Ads