diff --git a/demo/.env.example b/demo/.env.example index ac177e4..75118ce 100644 --- a/demo/.env.example +++ b/demo/.env.example @@ -2,3 +2,9 @@ MONGODB_URI= PAYLOAD_SECRET= PLAUSIBLE_API_KEY= +PLAUSIBLE_SITE_ID= +PLAUSIBLE_HOST= + +GOOGLE_PROPERTY_ID= +GOOGLE_CREDENTIALS_FILE="./ga_credentials.json" +GOOGLE_APPLICATION_CREDENTIALS= diff --git a/demo/src/payload.config.ts b/demo/src/payload.config.ts index a9de0a9..27ef387 100644 --- a/demo/src/payload.config.ts +++ b/demo/src/payload.config.ts @@ -25,7 +25,7 @@ const plausibleProvider: PlausibleProvider = { const googleProvider: GoogleProvider = { source: "google", - credentials: GOOGLE_CREDENTIALS_FILE, + //credentials: GOOGLE_CREDENTIALS_FILE, propertyId: GOOGLE_PROPERTY_ID, }; diff --git a/src/providers/google/client.ts b/src/providers/google/client.ts index d497b31..be9f59d 100644 --- a/src/providers/google/client.ts +++ b/src/providers/google/client.ts @@ -7,7 +7,7 @@ type ClientOptions = {}; function client(provider: GoogleProvider, options?: ClientOptions) { const analyticsDataClient = new BetaAnalyticsDataClient({ - keyFilename: provider.credentials, + ...(provider.credentials ? { keyFilename: provider.credentials } : {}), }); return { diff --git a/src/types/providers.d.ts b/src/types/providers.d.ts index f436d4c..e8394a5 100644 --- a/src/types/providers.d.ts +++ b/src/types/providers.d.ts @@ -7,6 +7,6 @@ export interface PlausibleProvider { interface GoogleProvider { source: "google"; - credentials: string; propertyId: string; + credentials?: string; }