TopRank Skills

Home / Claw Skills / API 集成 / google-analytics
Official OpenClaw rules 36%

google-analytics

Query Google Analytics 4 (GA4) data directly via the Analytics Data API. Use when you need website analytics like top pages, traffic sources, sessions, users, conversions, bounce rate, or any GA4 metrics and dimensions. Supports custom date ranges, filtering, and multi-metric queries. Calls analyticsdata.googleapis.com directly with no third-party proxy.

Stars

0

Installs

0

Status

ACTIVE

Visibility

PUBLIC

安装方式

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 google-analytics 技能。 若已安装,则直接安装 google-analytics 技能。

Overview

Skill Key
codeninja23/native-google-analytics
Author
codeninja23
Source Repo
openclaw/skills
Version
-
Source Path
skills/codeninja23/native-google-analytics
Latest Commit SHA
9a31fe476fb7ec57e9abe17ef34b1cded3db1aef

Extracted Content

SKILL.md excerpt

# Google Analytics 4

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

## Setup (one-time)

### 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):

```bash
pip install google-auth-oauthlib
```

```bash
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...

README excerpt

# native-google-analytics

An OpenClaw skill that queries Google Analytics 4 (GA4) directly via the [Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1). No third-party proxies, no external APIs, no SDK wrappers. Just your credentials talking to `analyticsdata.googleapis.com`.

## What it does

Ask OpenClaw for analytics data in plain English and it runs the appropriate GA4 query. Top pages, traffic sources, device breakdowns, custom date ranges, filters, etc.

## What you need

- A Google Cloud project with the Analytics Data API enabled
- OAuth 2.0 credentials (Desktop app)
- A GA4 property you have access to

## Setup

### 1. Google Cloud project

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

### 2. OAuth consent screen

Go to **APIs & Credentials > OAuth consent screen > Audience**.

Set **User type** to **Internal**. This skips Google's app verification process (which requires a demo video for sensitive scopes). Internal works for personal and team use but requires a Google Workspace account.

If you're on a personal @gmail.com, set it to External with publishing status "In production" instead.

### 3. Add the Analytics scope

Go to **OAuth consent screen > Data Access** and add:

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

### 4. Enable the API

Go to [Analytics Data API](https://console.cloud.google.com/apis/library/analyticsdata.googleapis.com) and click **Enable**.

### 5. Create OAuth credentials

Go to **Credentials > Create Credentials > OAuth client ID**. Select **Desktop app**.

Save the Client ID and Client Secret.

### 6. Get your GA4 Property ID

Go to [analytics.google.com](https://analytics.google.com) > **Admin** > **Property Settings**. Copy the numeric Property ID.

### 7. Generate a refresh token

```bash
pip install google-auth-oauthlib
```

```bash
python3 -c "
from google_auth_oauthlib.flow import InstalledAppFlow
flow = InstalledAppFl...

Related Claw Skills