Sanity Plugin
GA4 analytics, Google Search Console, and Lighthouse performance audits — all three dashboards directly inside Sanity Studio. One package. Zero context-switching.
By the numbers
What you get
GA4 analytics, Search Console search data, and Lighthouse performance scores — all inside Sanity Studio with a single package.
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.
Time series charts, hourly breakdowns, and channel grouping to understand your traffic patterns.
Clicks, impressions, CTR, average position — top queries, pages, countries, and devices from Google Search in one panel.
Performance, Accessibility, Best Practices, and SEO scores per page — mobile and desktop — pulled from PageSpeed Insights API.
See who's on your site right now — live active user count from the past 30 minutes, updated every fetch.
Top pages and landing pages with views and sessions. Know what content actually drives engagement.
Top countries and cities by user count. Understand where your audience actually lives.
Device categories, browser & OS breakdowns, new vs returning. Full picture of who reads your content.
Top events, traffic sources, referrers, and acquisition channels in one view.
Switch between 7, 14, 30, and 90 day views to analyze short and long-term trends instantly.
JWT-based service account authentication. No OAuth login flow required — just env vars.
Quick Setup
No complex config. No OAuth dance. Hover to pause, click a step to jump ahead.
Auto-advancing · hover to pause
Install & register the plugin
One npm command. Drop it in your Sanity config.
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
Secure by default
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.
Private keys live in environment variables and are only read by API routes.
Use a service account once instead of asking every editor to connect Google.
The Studio UI receives dashboard data, not Google credentials or secrets.
Workflow
Keep analytics, search performance, audits, and content work in the same place your team already publishes from.
One package. GA4 analytics, Search Console, and Lighthouse — all inside Sanity Studio in under 5 minutes.