Connects Plausible or Google Analytics 4 to the Payload admin and adds chart, info and report widgets. Widgets can be placed on the dashboard, on collection and global edit views, and a live visitors indicator can be added to the sidebar. An optional cache collection stores results to avoid API limits. Targets Payload 1.x.
Dashboard analytics integration plugin for Payload CMS
Installation
npm i @nouance/payload-dashboard-analytics190
Stars
6
Forks
18
Open Issues
3 years ago
Last Updated
40
Weekly Downloads
v0.3.0
npm Version
264.8 KB
Unpacked Size
2
Dependencies
190+9 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 190 |
| Dec 4, 2026 | 190 |
| Dec 3, 2026 | 190 |
| Dec 2, 2026 | 190 |
| Dec 1, 2026 | 190 |
| Nov 30, 2026 | 190 |
| Nov 29, 2026 | 190 |
| Nov 28, 2026 | 190 |
| Nov 27, 2026 | 190 |
| Nov 26, 2026 | 190 |
| Nov 25, 2026 | 190 |
| Nov 24, 2026 | 190 |
| Nov 23, 2026 | 190 |
| Nov 22, 2026 | 190 |
| Nov 21, 2026 | 190 |
| Nov 20, 2026 | 190 |
| Nov 19, 2026 | 190 |
| Nov 18, 2026 | 190 |
| Nov 17, 2026 | 190 |
| Nov 16, 2026 | 190 |
| Nov 15, 2026 | 190 |
| Nov 14, 2026 | 190 |
| Nov 13, 2026 | 189 |
| Nov 12, 2026 | 188 |
| Nov 11, 2026 | 188 |
| Nov 10, 2026 | 188 |
| Nov 9, 2026 | 188 |
| Nov 8, 2026 | 188 |
| Nov 7, 2026 | 188 |
| Nov 6, 2026 | 188 |
| Nov 5, 2026 | 187 |
| Nov 4, 2026 | 187 |
| Nov 3, 2026 | 186 |
| Nov 2, 2026 | 186 |
| Nov 1, 2026 | 186 |
| Oct 31, 2026 | 186 |
| Oct 30, 2026 | 186 |
| Oct 29, 2026 | 186 |
| Oct 28, 2026 | 186 |
| Oct 27, 2026 | 186 |
| Oct 26, 2026 | 185 |
| Oct 25, 2026 | 185 |
| Oct 24, 2026 | 185 |
| Oct 23, 2026 | 185 |
| Oct 22, 2026 | 185 |
| Oct 21, 2026 | 184 |
| Oct 20, 2026 | 184 |
| Oct 19, 2026 | 184 |
| Oct 18, 2026 | 184 |
| Oct 17, 2026 | 184 |
| Oct 16, 2026 | 184 |
| Oct 15, 2026 | 184 |
| Oct 14, 2026 | 184 |
| Oct 13, 2026 | 184 |
| Oct 12, 2026 | 184 |
| Oct 11, 2026 | 183 |
| Oct 10, 2026 | 183 |
| Oct 9, 2026 | 183 |
| Oct 8, 2026 | 183 |
| Oct 7, 2026 | 183 |
| Oct 6, 2026 | 183 |
| Oct 5, 2026 | 183 |
| Oct 4, 2026 | 183 |
| Oct 3, 2026 | 182 |
| Oct 2, 2026 | 182 |
| Oct 1, 2026 | 182 |
| Sep 30, 2026 | 182 |
| Sep 29, 2026 | 182 |
| Sep 28, 2026 | 182 |
| Sep 27, 2026 | 182 |
| Sep 26, 2026 | 182 |
| Sep 25, 2026 | 182 |
| Sep 24, 2026 | 182 |
| Sep 23, 2026 | 181 |
| Sep 22, 2026 | 181 |
| Sep 21, 2026 | 181 |
| Sep 20, 2026 | 181 |
| Sep 19, 2026 | 181 |
| Sep 18, 2026 | 181 |
| Sep 17, 2026 | 181 |
| Sep 16, 2026 | 181 |
| Sep 15, 2026 | 181 |
| Sep 14, 2026 | 181 |
| Sep 13, 2026 | 181 |
| Sep 12, 2026 | 181 |
| Sep 11, 2026 | 181 |
| Sep 10, 2026 | 181 |
| Sep 9, 2026 | 181 |
| Sep 8, 2026 | 181 |
| Sep 7, 2026 | 181 |
| Sep 6, 2026 | 181 |
48+22 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 48 |
| Dec 4, 2026 | 30 |
| Dec 3, 2026 | 34 |
| Dec 2, 2026 | 24 |
| Dec 1, 2026 | 25 |
| Nov 30, 2026 | 26 |
| Nov 29, 2026 | 31 |
| Nov 28, 2026 | 25 |
| Nov 27, 2026 | 27 |
| Nov 26, 2026 | 25 |
| Nov 25, 2026 | 24 |
| Nov 24, 2026 | 22 |
| Nov 23, 2026 | 23 |
| Nov 22, 2026 | 18 |
| Nov 21, 2026 | 30 |
| Nov 20, 2026 | 28 |
| Nov 19, 2026 | 27 |
| Nov 18, 2026 | 39 |
| Nov 17, 2026 | 37 |
| Nov 16, 2026 | 39 |
| Nov 15, 2026 | 44 |
| Nov 14, 2026 | 46 |
| Nov 13, 2026 | 50 |
| Nov 12, 2026 | 49 |
| Nov 11, 2026 | 36 |
| Nov 10, 2026 | 46 |
| Nov 9, 2026 | 43 |
| Nov 8, 2026 | 44 |
| Nov 7, 2026 | 31 |
| Nov 6, 2026 | 25 |
| Nov 5, 2026 | 26 |
| Nov 4, 2026 | 26 |
| Nov 3, 2026 | 20 |
| Nov 2, 2026 | 20 |
| Nov 1, 2026 | 23 |
| Oct 31, 2026 | 21 |
| Oct 30, 2026 | 22 |
| Oct 29, 2026 | 20 |
| Oct 28, 2026 | 20 |
| Oct 27, 2026 | 36 |
| Oct 26, 2026 | 43 |
| Oct 25, 2026 | 46 |
| Oct 24, 2026 | 48 |
| Oct 23, 2026 | 46 |
| Oct 22, 2026 | 47 |
| Oct 21, 2026 | 72 |
| Oct 20, 2026 | 65 |
| Oct 19, 2026 | 70 |
| Oct 18, 2026 | 66 |
| Oct 17, 2026 | 72 |
| Oct 16, 2026 | 75 |
| Oct 15, 2026 | 78 |
| Oct 14, 2026 | 86 |
| Oct 13, 2026 | 76 |
| Oct 12, 2026 | 69 |
| Oct 11, 2026 | 59 |
| Oct 10, 2026 | 54 |
| Oct 9, 2026 | 53 |
| Oct 8, 2026 | 52 |
| Oct 7, 2026 | 22 |
| Oct 6, 2026 | 27 |
| Oct 5, 2026 | 23 |
| Oct 4, 2026 | 26 |
| Oct 3, 2026 | 26 |
| Oct 2, 2026 | 25 |
| Oct 1, 2026 | 24 |
| Sep 30, 2026 | 40 |
| Sep 29, 2026 | 34 |
| Sep 28, 2026 | 32 |
| Sep 27, 2026 | 30 |
| Sep 26, 2026 | 30 |
| Sep 25, 2026 | 30 |
| Sep 24, 2026 | 40 |
| Sep 23, 2026 | 32 |
| Sep 22, 2026 | 50 |
| Sep 21, 2026 | 62 |
| Sep 20, 2026 | 61 |
| Sep 19, 2026 | 58 |
| Sep 18, 2026 | 57 |
| Sep 17, 2026 | 46 |
| Sep 16, 2026 | 36 |
| Sep 15, 2026 | 18 |
| Sep 14, 2026 | 6 |
| Sep 13, 2026 | 6 |
| Sep 12, 2026 | 7 |
| Sep 11, 2026 | 10 |
| Sep 10, 2026 | 12 |
| Sep 9, 2026 | 17 |
| Sep 8, 2026 | 26 |
| Sep 7, 2026 | 28 |
| Sep 6, 2026 | 26 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/619101028-root)<a href="https://payloaddirectory.dev/plugins/619101028-root"><img src="https://payloaddirectory.dev/badge/619101028-root.svg" alt="Payload Directory"></a>README
A plugin for Payload CMS to connect analytics data to your Payload dashboard.
Features:
yarn add @nouance/payload-dashboard-analytics
# OR
npm i @nouance/payload-dashboard-analytics
In the plugins array of your Payload config, call the plugin with options:
// ...
payloadDashboardAnalytics({
provider: {
source: "plausible",
apiSecret: PLAUSIBLE_API_KEY,
siteId: PLAUSIBLE_SITE_ID,
host: PLAUSIBLE_HOST, // optional, for self-hosted instances
},
cache: true,
access: (user: any) => {
return Boolean(user);
},
navigation: {
afterNavLinks: [
{
type: "live",
},
],
},
dashboard: {
beforeDashboard: ["viewsChart"],
afterDashboard: ["topPages"],
},
globals: [
{
slug: "homepage",
widgets: [
{
type: "info",
label: "Page data",
metrics: ["views", "sessions", "sessionDuration"],
timeframe: "currentMonth",
idMatcher: () => `/`,
},
],
},
],
collections: [
{
slug: Posts.slug,
widgets: [
{
type: "chart",
label: "Views and visitors",
metrics: ["views", "visitors", "sessions"],
timeframe: "30d",
idMatcher: (document: any) => `/articles/${document.slug}`,
},
],
},
],
}),
// ...
provider | required
Configuration for a supported provider.
access | optional
Accepts a function that takes in the req.user object to determine access to the API routes. By default the routes are unprotected.
Example to allow only authenticated users:
access: (user: any) => Boolean(user);
cache | optional
Accepts a boolean or a configuration object for cache management. Defaults to false.
This creates a new collection type that will store cached data so that you don't get limited by the API.
cache: true;
slug | optional
You can customise the slug of this new collection to avoid conflicts. Defaults to analyticsData.
routes | optional
By default all routes are cached to one day. This is because for most analytics platforms the data report is about one day out anyway. Live data is cached to 5 minutes.
Object with any of these keys globalAggregate globalChart pageAggregate pageChart report live set to a number in minutes.
routes?: {
globalAggregate: 1440;
globalChart: 1440;
pageAggregate: 1440;
pageChart: 1440;
report: 1440;
live: 5;
};
navigation | optional
Object of either beforeNavLinks afterNavLinks which are arrays of navigation widgets.
dashboard | optional
Object of either beforeDashboard afterDashboard which are arrays of dashboard widgets.
globals | optional
Array of global configurations requiring a slug and an array of page widgets.
collections | optional
Array of collection configurations requiring a slug and an array of page widgets.
A full list of supported widgets. Due to some time limitations or API constraints the selection may be limited.
Navigation widgets have no configuration.

type live
{
type: "live";
}
Dashboard widgets have no configuration.

type viewsChart
["viewsChart"];

type topPages
["topPages"];
Page widgets have more configuration available with custom timeframes and metrics. These are usable on both globals and collections.

type | chart | required
label | string or hidden | optional
Sets a custom label for the component in the frontend, defaults to a list of metrics and it's accompanied by the timeframe.
If hidden then the label is not displayed.
metrics | metric[] | required
Array of metrics to fetch data for. See list of available metrics.
timeframe | timeframe | optional
Defaults to 30d. See list of available timeframes.
idMatches | function | required
A function that takes in the published document from the React hook useDocument and returns a string that matches the current page to a page in the analytics data.
{
type: "chart",
label: "Views and visitors",
metrics: ["views", "visitors", "sessions"],
timeframe: "30d",
idMatcher: (document: any) => `/blog/${document.slug}`,
}

type | info | required
label | string or hidden | optional
Sets a custom label for the component in the frontend, defaults to a list of metrics and it's accompanied by the timeframe.
If hidden then the label is not displayed.
metrics | metric[] | required
Array of metrics to fetch data for. See list of available metrics.
timeframe | timeframe | optional
Defaults to 30d. See list of available timeframes.
idMatches | function | required
A function that takes in the published document from the React hook useDocument and returns a string that matches the current page to a page in the analytics data.
{
type: "info",
label: "Views and visitors",
metrics: ["views", "visitors", "sessions"],
timeframe: "7d",
idMatcher: (document: any) => `/blog/${document.slug}`,
}
Currently supported timeframes.
12mo6mo30d7dcurrentMonth limits the data period to the current monthA full list of currently supported metrics, each provider will map these on their own internally to the API they communicate with.
viewsvisitorssessionssessionDurationbounceRateProperties are used to generate reports, currently the widgets are limited in configuration but these should be fully supported via the API routes.
pagesourceentryPointexitPointcountryWe support Plausible's Stats API, more information on their website.
source | "plausible" | required
apiSecret | string | required You can generate an API secret in the admin panel of Plausible.
siteId | string | required
host | string | optional
Set this value to the full domain host including protocol if you're self hosting Plausible, eg. https://plausible.example.com
Example
const plausibleProvider: PlausibleProvider = {
source: "plausible",
apiSecret: PLAUSIBLE_API_KEY,
siteId: PLAUSIBLE_SITE_ID,
host: PLAUSIBLE_HOST,
};
We support the GA4 Analytics API only. You will need to get a credentials file from Google here, and follow the initial setup instructions so that these credentials have the correct read access to your analytics data.
source | "google" | required
propertyId | string | required The id of your target property, you can find this information in the GA property settings panel.
credentials | string | optional
Path to your credentials.json file, make sure the filesystem has access to this, alternatively, set an environment variable named GOOGLE_APPLICATION_CREDENTIALS with the path to the credentials file.
Example
const googleProvider: GoogleProvider = {
source: "google",
credentials: GOOGLE_CREDENTIALS_FILE,
propertyId: GOOGLE_PROPERTY_ID,
};
To do, add API documentation.
Multi-metric charts have a floating tooltip in the wrong position, this is a problem upstream.
For development purposes, there is a full working example of how this plugin might be used in the demo of this repo. Then:
git clone [email protected]:NouanceLabs/payload-dashboard-analytics.git \
cd payload-dashboard-analytics && yarn \
cd demo && yarn \
cp .env.example .env \
vim .env \ # add your API creds to this file
yarn dev
Tbd
payload plugin ga4 ecommerce
GA4 reporting dashboards and per-record analytics tabs inside the Payload admin panel
44115/wk10v3
payload plugin analytics
GA4-backed analytics dashboard in the Payload admin with a client-side tracking layer for Next.js front ends
70821/wk37v3
payload plugin google analytics
Google Analytics 4 dashboard widgets for the Payload admin panel
57621/wk8v3 v4
payload plugin stats
Privacy-preserving user count statistics for the Payload admin, with small groups hidden
7380/wk0v3
tracking
Tracking global and React providers for PostHog, Google Tag Manager and Vercel Analytics
6132/wk37v3
payload plugin gtm
Google Tag Manager and GA4 for Payload with automatic dataLayer event discovery and an editable event registry
6031/wk0v3