# Send Native Google Analytics to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "native-google-analytics",
    "name": "Native Google Analytics",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/codeninja23/native-google-analytics",
    "canonicalUrl": "https://clawhub.ai/codeninja23/native-google-analytics",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/native-google-analytics",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=native-google-analytics",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "scripts/ga4_auth.py",
      "scripts/ga4_query.py"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "native-google-analytics",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-06T00:08:38.652Z",
      "expiresAt": "2026-05-13T00:08:38.652Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=native-google-analytics",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=native-google-analytics",
        "contentDisposition": "attachment; filename=\"native-google-analytics-0.1.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "native-google-analytics"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/native-google-analytics"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/native-google-analytics",
    "downloadUrl": "https://openagent3.xyz/downloads/native-google-analytics",
    "agentUrl": "https://openagent3.xyz/skills/native-google-analytics/agent",
    "manifestUrl": "https://openagent3.xyz/skills/native-google-analytics/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/native-google-analytics/agent.md"
  }
}
```
## Documentation

### Google Analytics 4

Query GA4 properties directly via the Google Analytics Data API (analyticsdata.googleapis.com).

### 1. Create a Google Cloud project (or use an existing one)

Go to https://console.cloud.google.com and create or select a project.

### 2. Set the OAuth consent screen to Internal

Go to APIs & Credentials > OAuth consent screen > Audience and set:

User type: Internal

This avoids Google's app verification process (which requires a demo video for sensitive scopes like Analytics). Internal is fine for personal/team use. Note: this requires a Google Workspace account (not a personal @gmail.com).

If you must use External (e.g. you have a personal Gmail), set publishing status to "In production" and add the analytics.readonly scope under Data Access / Scopes.

### 3. Add the Analytics scope

Go to OAuth consent screen > Data Access (or Scopes) and add:

https://www.googleapis.com/auth/analytics.readonly

This is listed as a "sensitive scope" by Google. If your app is Internal, no verification is needed.

### 4. Enable the Analytics Data API

Go to: https://console.cloud.google.com/apis/library/analyticsdata.googleapis.com

Click Enable.

### 5. Create OAuth 2.0 credentials

Go to APIs & Credentials > Credentials > Create Credentials > OAuth client ID

Application type: Desktop app
Name: anything you want

Save the Client ID and Client Secret.

### 6. Get your GA4 Property ID

Go to https://analytics.google.com > Admin (gear icon) > Property Settings. The Property ID is the numeric value at the top.

### 7. Generate a refresh token

Run this on your local machine (needs a browser for the Google login flow):

pip install google-auth-oauthlib

python3 -c "from google_auth_oauthlib.flow import InstalledAppFlow; flow = InstalledAppFlow.from_client_config({'installed': {'client_id': 'YOUR_CLIENT_ID', 'client_secret': 'YOUR_CLIENT_SECRET', 'auth_uri': 'https://accounts.google.com/o/oauth2/auth', 'token_uri': 'https://oauth2.googleapis.com/token'}}, scopes=['https://www.googleapis.com/auth/analytics.readonly']); creds = flow.run_local_server(port=0); print('REFRESH TOKEN:', creds.refresh_token)"

Replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with your values. A browser window will open for you to log in with Google. Copy the refresh token from the output.

### 8. Set environment variables

GA4_PROPERTY_ID=123456789
GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_REFRESH_TOKEN=your-refresh-token

### Troubleshooting

403 HTML error page: The analytics.readonly scope is probably not added to your OAuth consent screen. Go to Data Access/Scopes and add it, then regenerate your refresh token.
403 JSON error "caller does not have permission": Your Google account doesn't have access to the GA4 property. Check Admin > Property Access Management in Google Analytics.
Token refresh fails: Your refresh token may be expired. Regenerate it using step 7.

### Top pages by pageviews

python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\
  --metrics screenPageViews \\
  --dimension pagePath \\
  --limit 20

### Top pages with sessions and users

python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\
  --metrics screenPageViews,sessions,totalUsers \\
  --dimension pagePath \\
  --limit 20

### Traffic sources

python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\
  --metrics sessions \\
  --dimension sessionSource \\
  --limit 20

### Traffic by source and medium

python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\
  --metrics sessions,totalUsers,conversions \\
  --dimensions sessionSource,sessionMedium \\
  --limit 20

### Landing pages

python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\
  --metrics sessions,bounceRate \\
  --dimension landingPage \\
  --limit 30

### Custom date range

python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\
  --metrics screenPageViews,sessions \\
  --dimension pagePath \\
  --start 2026-01-01 \\
  --end 2026-01-31 \\
  --limit 20

### Filter by path prefix

python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\
  --metrics screenPageViews,sessions \\
  --dimension pagePath \\
  --filter "pagePath=~/blog/" \\
  --limit 20

### Conversions by campaign

python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\
  --metrics conversions,sessions \\
  --dimensions sessionCampaignName,sessionSource \\
  --limit 20

### Device breakdown

python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\
  --metrics sessions,totalUsers \\
  --dimension deviceCategory \\
  --limit 10

### Country breakdown

python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\
  --metrics sessions,totalUsers \\
  --dimension country \\
  --limit 20

### Common metrics

screenPageViews, sessions, totalUsers, newUsers, activeUsers, bounceRate, averageSessionDuration, conversions, eventCount, engagementRate, userEngagementDuration

### Common dimensions

pagePath, pageTitle, landingPage, sessionSource, sessionMedium, sessionCampaignName, country, city, deviceCategory, browser, date, week, month

### Output

Results are printed as a formatted table to stdout. Pipe to | python3 -m json.tool if you need raw JSON.
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: codeninja23
- Version: 0.1.1
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-06T00:08:38.652Z
- Expires at: 2026-05-13T00:08:38.652Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/native-google-analytics)
- [Send to Agent page](https://openagent3.xyz/skills/native-google-analytics/agent)
- [JSON manifest](https://openagent3.xyz/skills/native-google-analytics/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/native-google-analytics/agent.md)
- [Download page](https://openagent3.xyz/downloads/native-google-analytics)