{
  "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": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/native-google-analytics",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=native-google-analytics",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "scripts/ga4_auth.py",
      "scripts/ga4_query.py"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "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."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "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."
        },
        {
          "label": "Upgrade existing",
          "body": "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."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "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."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/native-google-analytics",
    "agentPageUrl": "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"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "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."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "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."
      },
      {
        "label": "Upgrade existing",
        "body": "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."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Google Analytics 4",
        "body": "Query GA4 properties directly via the Google Analytics Data API (analyticsdata.googleapis.com)."
      },
      {
        "title": "1. Create a Google Cloud project (or use an existing one)",
        "body": "Go to https://console.cloud.google.com and create or select a project."
      },
      {
        "title": "2. Set the OAuth consent screen to Internal",
        "body": "Go to APIs & Credentials > OAuth consent screen > Audience and set:\n\nUser type: Internal\n\nThis 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).\n\nIf 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."
      },
      {
        "title": "3. Add the Analytics scope",
        "body": "Go to OAuth consent screen > Data Access (or Scopes) and add:\n\nhttps://www.googleapis.com/auth/analytics.readonly\n\nThis is listed as a \"sensitive scope\" by Google. If your app is Internal, no verification is needed."
      },
      {
        "title": "4. Enable the Analytics Data API",
        "body": "Go to: https://console.cloud.google.com/apis/library/analyticsdata.googleapis.com\n\nClick Enable."
      },
      {
        "title": "5. Create OAuth 2.0 credentials",
        "body": "Go to APIs & Credentials > Credentials > Create Credentials > OAuth client ID\n\nApplication type: Desktop app\nName: anything you want\n\nSave the Client ID and Client Secret."
      },
      {
        "title": "6. Get your GA4 Property ID",
        "body": "Go to https://analytics.google.com > Admin (gear icon) > Property Settings. The Property ID is the numeric value at the top."
      },
      {
        "title": "7. Generate a refresh token",
        "body": "Run this on your local machine (needs a browser for the Google login flow):\n\npip install google-auth-oauthlib\n\npython3 -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)\"\n\nReplace 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."
      },
      {
        "title": "8. Set environment variables",
        "body": "GA4_PROPERTY_ID=123456789\nGOOGLE_CLIENT_ID=your-client-id\nGOOGLE_CLIENT_SECRET=your-client-secret\nGOOGLE_REFRESH_TOKEN=your-refresh-token"
      },
      {
        "title": "Troubleshooting",
        "body": "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.\n403 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.\nToken refresh fails: Your refresh token may be expired. Regenerate it using step 7."
      },
      {
        "title": "Top pages by pageviews",
        "body": "python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics screenPageViews \\\n  --dimension pagePath \\\n  --limit 20"
      },
      {
        "title": "Top pages with sessions and users",
        "body": "python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics screenPageViews,sessions,totalUsers \\\n  --dimension pagePath \\\n  --limit 20"
      },
      {
        "title": "Traffic sources",
        "body": "python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics sessions \\\n  --dimension sessionSource \\\n  --limit 20"
      },
      {
        "title": "Traffic by source and medium",
        "body": "python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics sessions,totalUsers,conversions \\\n  --dimensions sessionSource,sessionMedium \\\n  --limit 20"
      },
      {
        "title": "Landing pages",
        "body": "python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics sessions,bounceRate \\\n  --dimension landingPage \\\n  --limit 30"
      },
      {
        "title": "Custom date range",
        "body": "python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics screenPageViews,sessions \\\n  --dimension pagePath \\\n  --start 2026-01-01 \\\n  --end 2026-01-31 \\\n  --limit 20"
      },
      {
        "title": "Filter by path prefix",
        "body": "python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics screenPageViews,sessions \\\n  --dimension pagePath \\\n  --filter \"pagePath=~/blog/\" \\\n  --limit 20"
      },
      {
        "title": "Conversions by campaign",
        "body": "python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics conversions,sessions \\\n  --dimensions sessionCampaignName,sessionSource \\\n  --limit 20"
      },
      {
        "title": "Device breakdown",
        "body": "python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics sessions,totalUsers \\\n  --dimension deviceCategory \\\n  --limit 10"
      },
      {
        "title": "Country breakdown",
        "body": "python3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics sessions,totalUsers \\\n  --dimension country \\\n  --limit 20"
      },
      {
        "title": "Common metrics",
        "body": "screenPageViews, sessions, totalUsers, newUsers, activeUsers, bounceRate, averageSessionDuration, conversions, eventCount, engagementRate, userEngagementDuration"
      },
      {
        "title": "Common dimensions",
        "body": "pagePath, pageTitle, landingPage, sessionSource, sessionMedium, sessionCampaignName, country, city, deviceCategory, browser, date, week, month"
      },
      {
        "title": "Output",
        "body": "Results are printed as a formatted table to stdout. Pipe to | python3 -m json.tool if you need raw JSON."
      }
    ],
    "body": "Google Analytics 4\n\nQuery GA4 properties directly via the Google Analytics Data API (analyticsdata.googleapis.com).\n\nSetup (one-time)\n1. Create a Google Cloud project (or use an existing one)\n\nGo to https://console.cloud.google.com and create or select a project.\n\n2. Set the OAuth consent screen to Internal\n\nGo to APIs & Credentials > OAuth consent screen > Audience and set:\n\nUser type: Internal\n\nThis 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).\n\nIf 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.\n\n3. Add the Analytics scope\n\nGo to OAuth consent screen > Data Access (or Scopes) and add:\n\nhttps://www.googleapis.com/auth/analytics.readonly\n\n\nThis is listed as a \"sensitive scope\" by Google. If your app is Internal, no verification is needed.\n\n4. Enable the Analytics Data API\n\nGo to: https://console.cloud.google.com/apis/library/analyticsdata.googleapis.com\n\nClick Enable.\n\n5. Create OAuth 2.0 credentials\n\nGo to APIs & Credentials > Credentials > Create Credentials > OAuth client ID\n\nApplication type: Desktop app\nName: anything you want\n\nSave the Client ID and Client Secret.\n\n6. Get your GA4 Property ID\n\nGo to https://analytics.google.com > Admin (gear icon) > Property Settings. The Property ID is the numeric value at the top.\n\n7. Generate a refresh token\n\nRun this on your local machine (needs a browser for the Google login flow):\n\npip install google-auth-oauthlib\n\npython3 -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)\"\n\n\nReplace 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.\n\n8. Set environment variables\nGA4_PROPERTY_ID=123456789\nGOOGLE_CLIENT_ID=your-client-id\nGOOGLE_CLIENT_SECRET=your-client-secret\nGOOGLE_REFRESH_TOKEN=your-refresh-token\n\nTroubleshooting\n403 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.\n403 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.\nToken refresh fails: Your refresh token may be expired. Regenerate it using step 7.\nQueries\nTop pages by pageviews\npython3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics screenPageViews \\\n  --dimension pagePath \\\n  --limit 20\n\nTop pages with sessions and users\npython3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics screenPageViews,sessions,totalUsers \\\n  --dimension pagePath \\\n  --limit 20\n\nTraffic sources\npython3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics sessions \\\n  --dimension sessionSource \\\n  --limit 20\n\nTraffic by source and medium\npython3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics sessions,totalUsers,conversions \\\n  --dimensions sessionSource,sessionMedium \\\n  --limit 20\n\nLanding pages\npython3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics sessions,bounceRate \\\n  --dimension landingPage \\\n  --limit 30\n\nCustom date range\npython3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics screenPageViews,sessions \\\n  --dimension pagePath \\\n  --start 2026-01-01 \\\n  --end 2026-01-31 \\\n  --limit 20\n\nFilter by path prefix\npython3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics screenPageViews,sessions \\\n  --dimension pagePath \\\n  --filter \"pagePath=~/blog/\" \\\n  --limit 20\n\nConversions by campaign\npython3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics conversions,sessions \\\n  --dimensions sessionCampaignName,sessionSource \\\n  --limit 20\n\nDevice breakdown\npython3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics sessions,totalUsers \\\n  --dimension deviceCategory \\\n  --limit 10\n\nCountry breakdown\npython3 /mnt/skills/user/google-analytics/scripts/ga4_query.py \\\n  --metrics sessions,totalUsers \\\n  --dimension country \\\n  --limit 20\n\nCommon metrics\n\nscreenPageViews, sessions, totalUsers, newUsers, activeUsers, bounceRate, averageSessionDuration, conversions, eventCount, engagementRate, userEngagementDuration\n\nCommon dimensions\n\npagePath, pageTitle, landingPage, sessionSource, sessionMedium, sessionCampaignName, country, city, deviceCategory, browser, date, week, month\n\nOutput\n\nResults are printed as a formatted table to stdout. Pipe to | python3 -m json.tool if you need raw JSON."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/codeninja23/native-google-analytics",
    "publisherUrl": "https://clawhub.ai/codeninja23/native-google-analytics",
    "owner": "codeninja23",
    "version": "0.1.1",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "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"
  }
}