GA Analytics
v1.0.2 · Open Source · Sanity v3

Google Analytics
inside your studio

A comprehensive GA4 dashboard with real-time metrics, traffic insights, audience breakdowns, content performance, and more — directly inside Sanity Studio.

Terminal

$ npm install sanity-plugin-ga-dashboard

added 1 packages in 2.1s

$

7

Dashboard Tabs

16

Parallel Queries

Live

Real-time Data

< 3 min

Setup Time

What you get

Everything your analytics needs

Seven dashboard tabs covering every aspect of your website performance, powered by 16 parallel GA4 API queries.

Overview Metrics

Users, sessions, pageviews, bounce rate, engagement, and session duration — 10 KPIs at a glance.

Traffic & Channels

Time series charts, hourly breakdowns, and channel grouping to understand your traffic patterns.

Content & Pages

Top pages and landing pages with views and sessions — know what content drives engagement.

Audience & Devices

Device categories, browser & OS breakdowns, and new vs returning visitor analysis.

Geography

Top countries and cities by user count. Understand where your audience lives.

Events & Acquisition

Top events, traffic sources, referrers, and acquisition channels in one view.

Real-time Users

See how many users are active right now with live data from the past 30 minutes.

Date Range Picker

Switch between 7, 14, 30, and 90 day views to analyze short and long-term trends.

Secure Auth

JWT-based service account authentication. No OAuth login flow required.

Quick Setup

Three steps to analytics

1

Install & register the plugin

sanity.config.ts
import { defineConfig } from 'sanity'
import { googleAnalyticsPlugin } from 'sanity-plugin-ga-dashboard'

export default defineConfig({
  plugins: [
    googleAnalyticsPlugin(),
  ],
  schema: {
    types: [/* your schemas */],
  },
})
2

Add the API route

app/api/analytics/route.ts
// app/api/analytics/route.ts
export { GET } from 'sanity-plugin-ga-dashboard/api'
3

Set your environment variables

.env.local
# .env.local
GA_PROPERTY_ID=123456789
GA_SERVICE_ACCOUNT_EMAIL=my-sa@project.iam.gserviceaccount.com
GA_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
MIT License · Free Forever

Ready to see your analytics?

Install the plugin and view your GA4 data inside Sanity Studio in under 3 minutes.