Analytics
v0.2.0 · Sanity v3 · TypeScript

Sanity Plugin

Analytics Suiteinside your studio

GA4 analytics, Google Search Console, and Lighthouse performance audits — all three dashboards directly inside Sanity Studio. One package. Zero context-switching.

Terminal
$npm install sanity-plugin-analytics
added 1 package in 2.1s
found 0 vulnerabilities
$
GA4 AnalyticsSearch ConsoleLighthouse AuditsReal-time Data16 Parallel QueriesZero ConfigServer-side AuthNo Client KeysSanity v3TypeScriptGA4 AnalyticsSearch ConsoleLighthouse AuditsReal-time Data16 Parallel QueriesZero ConfigServer-side AuthNo Client KeysSanity v3TypeScript

By the numbers

3
Plugins in One
GA4 · Search Console · Lighthouse
16
Parallel GA4 Queries
Blazing fast data fetching
Live
Real-time Data
30-minute active user window
< 5 min
Setup Time
From install to dashboard

What you get

Three plugins.
One install.

GA4 analytics, Search Console search data, and Lighthouse performance scores — all inside Sanity Studio with a single package.

GA4 Overview Metrics

Users, sessions, pageviews, bounce rate, engagement, and session duration — 10 KPIs at a glance. Every number you need to prove content ROI without leaving Sanity.

UsersSessionsPageviewsBounce RateAvg DurationEngagement
Learn more

Traffic & Channels

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

Learn more

Search Console

Clicks, impressions, CTR, average position — top queries, pages, countries, and devices from Google Search in one panel.

Learn more

Lighthouse Audits

Performance, Accessibility, Best Practices, and SEO scores per page — mobile and desktop — pulled from PageSpeed Insights API.

Learn more

Real-time Users

See who's on your site right now — live active user count from the past 30 minutes, updated every fetch.

Learn more

Content & Pages

Top pages and landing pages with views and sessions. Know what content actually drives engagement.

Learn more

Geography

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

Learn more

Audience & Devices

Device categories, browser & OS breakdowns, new vs returning. Full picture of who reads your content.

Learn more

Events & Acquisition

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

Learn more

Date Range Picker

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

Learn more

Secure Auth

JWT-based service account authentication. No OAuth login flow required — just env vars.

Learn more

Quick Setup

From npm to dashboard in 3 steps

No complex config. No OAuth dance. Hover to pause, click a step to jump ahead.

Auto-advancing · hover to pause

1

Install & register the plugin

One npm command. Drop it in your Sanity config.

sanity.config.ts
import { defineConfig } from 'sanity'
import { sanityAnalyticsPlugin } from 'sanity-plugin-analytics'

export default defineConfig({
  plugins: [
    sanityAnalyticsPlugin({
      analytics: {},
      searchConsole: {},
      lighthouse: {
        siteUrl: 'https://mysite.com',
        documentTypes: [{ type: 'post', slugField: 'slug', pathPrefix: '/blog' }],
      },
    }),
  ],
  schema: {
    types: [/* your schemas */],
  },
})

Live preview

sanity.config.ts
import { defineConfig } from 'sanity'
import { sanityAnalyticsPlugin } from 'sanity-plugin-analytics'
export default defineConfig({
plugins: [sanityAnalyticsPlugin({})],
});
Plugin registered successfully

Secure by default

Service account auth, kept server-side.

The browser talks to your own API routes. Those routes talk to Google with service account credentials, so analytics access stays behind your server boundary.

Credentials stay server-side

Private keys live in environment variables and are only read by API routes.

No OAuth flow

Use a service account once instead of asking every editor to connect Google.

No client-side keys

The Studio UI receives dashboard data, not Google credentials or secrets.

Workflow

Four tabs become one Studio view.

Keep analytics, search performance, audits, and content work in the same place your team already publishes from.

Before4 tabs
GA4 tab
GSC tab
Lighthouse tab
Studio tab
After1 view
Sanity Studio
GA4
Search Console
Lighthouse
Content
Server-side auth · No client keys

Ready to see your analytics inside Sanity?

One package. GA4 analytics, Search Console, and Lighthouse — all inside Sanity Studio in under 5 minutes.

3 dashboards16 GA4 queries< 5 min setupNo OAuth