@@ -6,11 +6,19 @@ import Tags from "./collections/Tags";
66import Users from "./collections/Users" ;
77import Media from "./collections/Media" ;
88import payloadDashboardAnalytics from "../../src/index" ;
9+ import { PlausibleProvider } from "../../src/types/providers" ;
910
1011const PLAUSIBLE_API_KEY = process . env . PLAUSIBLE_API_KEY ;
1112const PLAUSIBLE_HOST = process . env . PLAUSIBLE_HOST ;
1213const PLAUSIBLE_SITE_ID = process . env . PLAUSIBLE_SITE_ID ;
1314
15+ const plausibleProvider : PlausibleProvider = {
16+ source : "plausible" ,
17+ apiSecret : PLAUSIBLE_API_KEY ,
18+ siteId : PLAUSIBLE_SITE_ID ,
19+ host : PLAUSIBLE_HOST ,
20+ } ;
21+
1422export default buildConfig ( {
1523 serverURL : "http://localhost:3000" ,
1624 admin : {
@@ -42,41 +50,40 @@ export default buildConfig({
4250 } ,
4351 plugins : [
4452 payloadDashboardAnalytics ( {
45- provider : {
46- source : "plausible" ,
47- apiSecret : PLAUSIBLE_API_KEY ,
48- siteId : PLAUSIBLE_SITE_ID ,
49- host : PLAUSIBLE_HOST ,
50- } ,
53+ provider : plausibleProvider ,
5154 collections : [
5255 {
5356 slug : Posts . slug ,
5457 widgets : [
5558 {
5659 type : "chart" ,
57- metrics : [ "pageViews" , "uniqueVisitors" ] ,
60+ label : "Views and visitors" ,
61+ metrics : [ "views" , "visitors" , "sessions" ] ,
5862 timeframe : "30d" ,
5963 idMatcher : ( document : any ) => `/articles/${ document . slug } ` ,
6064 } ,
6165 {
6266 type : "chart" ,
63- metrics : [ "pageViews " ] ,
67+ metrics : [ "sessions " ] ,
6468 timeframe : "7d" ,
6569 idMatcher : ( document : any ) => `/articles/${ document . slug } ` ,
6670 } ,
6771 {
6872 type : "chart" ,
69- metrics : [ "uniqueVisitors " ] ,
73+ metrics : [ "sessionDuration " ] ,
7074 timeframe : "currentMonth" ,
7175 idMatcher : ( document : any ) => `/articles/${ document . slug } ` ,
7276 } ,
7377 /* {
7478 type: "info",
75- metric: "totalViews",
79+ metrics: ["views"],
80+ idMatcher: (document: any) => `/articles/${document.slug}`,
7681 },
7782 {
7883 type: "info",
79- metric: "liveVisitors",
84+ metrics: ["sessions", "sessionDuration"],
85+ timeframe: "6mo",
86+ idMatcher: (document: any) => `/articles/${document.slug}`,
8087 }, */
8188 ] ,
8289 } ,
0 commit comments