Analytics
docs

Changelog

All notable changes to sanity-plugin-analytics. Follows Keep a Changelog · Semantic Versioning

+Added~Changed×FixedRemovedSecurity!Deprecated
v0.2.0Jul 21, 2026latest+4~4×4·1

+ ✨ Added

+createSeoView — new combined document-view factory that shows Search Console page metrics (clicks, impressions, CTR, position) and the latest Lighthouse scores for a document side by side in one Studio tab, instead of switching between separate views. Exported alongside createLighthouseView from the package root, with a new SeoDocumentViewConfig type (extends LighthouseConfig with searchConsoleApiUrl and range).
+sanityAnalyticsPlugin({ layout: 'separate' }) — new layout mode that registers each enabled section (Analytics, Search Console, Lighthouse) as its own distinct Studio tool with its own top-nav entry and URL, instead of one tabbed tool. layout: 'combined' (the previous behavior) remains the default.
+Per-section name/title overrides — GoogleAnalyticsConfig, SearchConsoleConfig, and LighthouseConfig each gain optional title/name fields controlling the tool's label and URL segment when used with layout: 'separate'.
+Manual "Refresh" bypasses the response cache — dashboards now pass a force flag through fetchAnalyticsData / fetchSearchConsoleData so clicking Refresh always re-fetches, while normal tab/date-range switching still reads from cache.

~ 🔄 Changed

~In-memory response cache (utils/cache.ts) — GA4 and Search Console API responses are now cached for 15 minutes per query key, shared across dashboard mounts within a session, with in-flight request de-duping so switching tabs/date-ranges doesn't re-hit the API for data already fetched.
~Bundled runtime dependencies — jose, lucide-react, and recharts are bundled into dist via tsup's noExternal and moved from dependencies to devDependencies, so consumers no longer install them a second time on top of the bundled copies.
~Removed unused @sanity/ui peer dependency — the package has no @sanity/ui imports; it no longer appears in peerDependencies.
~Dashboard sidebar and tab styling refreshed (accent-aware active states, tab indicator bar, softer surfaces).

× 🐛 Fixed

×Stale package-name references in API route JSDoc — the /api/analytics and /api/search-console handler docstrings pointed to the old sanity-plugin-ga-dashboard/* import paths instead of sanity-plugin-analytics/api/*. These examples compile into the published .d.ts/.d.cts files, so IDE hover hints now show the correct import.
×createLighthouseView crash on malformed stored report JSON — JSON.parse of a saved Lighthouse report is now wrapped in try/catch instead of throwing and blanking the view.
×Lighthouse dashboard's "Fetch Remaining" silently failing — missing siteUrl/documentTypes config previously showed a blocking window.alert; it now shows an inline banner explaining what to configure.
×Sourcemaps are no longer shipped in the npm tarball (sourcemap: false), cutting unpacked package size from ~7.5 MB to ~2.6 MB.

· 📝 Documentation

·README: added a link to the docs site and listed createSeoView/createLighthouseView under Exports.
v0.1.0Jun 21, 2026+6

+ ✨ Added

+Combined Sanity Studio analytics plugin with GA4, Search Console, and Lighthouse tabs.
+Individual plugin exports for GA4, Search Console, and Lighthouse.
+Re-exportable Next.js App Router handlers:
+Lighthouse report schema and dashboard with configurable Sanity document URL mapping.
+createLighthouseView Sanity Studio document view factory.
+TypeScript types for plugin configuration and dashboard data.