diff --git a/.env.example b/.env.example
index ee5dc77..b067006 100644
--- a/.env.example
+++ b/.env.example
@@ -2,6 +2,7 @@ GITHUB_TOKEN=
# Plausible
BASE_URL=http://plausible.localhost
-PLAUSIBLE_DOMAIN=http://plausible.localhost
+PLAUSIBLE_DATA_DOMAIN=http://backstage.localhost
+PLAUSIBLE_SOURCE_DOMAIN=http://plausible.localhost
SECRET_KEY_BASE=
TOTP_VAULT_KEY=
\ No newline at end of file
diff --git a/.release-it.json b/.release-it.json
deleted file mode 100644
index 2cd8f78..0000000
--- a/.release-it.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "$schema": "https://unpkg.com/release-it@17/schema/release-it.json",
- "github": {
- "release": false
- },
- "npm": false
-}
\ No newline at end of file
diff --git a/app-config.production.yaml b/app-config.production.yaml
index 31c2ad5..f349d22 100644
--- a/app-config.production.yaml
+++ b/app-config.production.yaml
@@ -34,4 +34,6 @@ catalog:
target: ../../examples/acme-corp.yaml
plausible:
- domain: ${PLAUSIBLE_DOMAIN}
+ enabled: true
+ dataDomain: ${PLAUSIBLE_DATA_DOMAIN}
+ sourceDomain: ${PLAUSIBLE_SOURCE_DOMAIN}
diff --git a/app-config.yaml b/app-config.yaml
index ac2ace1..aec6e99 100644
--- a/app-config.yaml
+++ b/app-config.yaml
@@ -73,5 +73,4 @@ catalog:
- allow: [Component, System, API, Resource, Location, Template, User, Group]
plausible:
- enabled: true
- domain: ${PLAUSIBLE_DOMAIN}
+ enabled: false
diff --git a/plugins/plausible/config.d.ts b/plugins/plausible/config.d.ts
index e809364..d3e81c5 100644
--- a/plugins/plausible/config.d.ts
+++ b/plugins/plausible/config.d.ts
@@ -8,6 +8,11 @@ export interface Config {
/**
* @visibility frontend
*/
- domain: string;
+ dataDomain: string;
+
+ /**
+ * @visibility frontend
+ */
+ sourceDomain: string;
};
}
diff --git a/plugins/plausible/src/components/PlausibleAnalytics.tsx b/plugins/plausible/src/components/PlausibleAnalytics.tsx
index c2ec17c..b326847 100644
--- a/plugins/plausible/src/components/PlausibleAnalytics.tsx
+++ b/plugins/plausible/src/components/PlausibleAnalytics.tsx
@@ -4,17 +4,13 @@ import React from 'react';
export const PlausibleAnalytics = () => {
const config = useApi(configApiRef);
const enabled = config.getOptionalBoolean('plausible.enabled') ?? false;
- const domain = config.getOptionalString('plausible.domain');
+ const dataDomain = config.getOptionalString('plausible.dataDomain');
+ const sourceDomain = config.getOptionalString('plausible.sourceDomain');
+ const source = `https://${sourceDomain}/js/script.js`;
- if (!enabled || !domain) {
+ if (!enabled || !dataDomain || !sourceDomain) {
return null;
}
- return (
-
- );
+ return ;
};
diff --git a/plugins/plausible/src/plugin.test.tsx b/plugins/plausible/src/plugin.test.tsx
index 84b8f73..2964350 100644
--- a/plugins/plausible/src/plugin.test.tsx
+++ b/plugins/plausible/src/plugin.test.tsx
@@ -38,7 +38,8 @@ describe('PlausibleAnalytics', () => {
const config = mockConfigApi({
plausible: {
enabled: true,
- domain: 'example.com',
+ dataDomain: 'example.com',
+ sourceDomain: 'plausible.example.com',
},
});
const { container } = render(
@@ -51,7 +52,7 @@ describe('PlausibleAnalytics', () => {
expect(scriptTag).toHaveAttribute('data-domain', 'example.com');
expect(scriptTag).toHaveAttribute(
'src',
- 'https://plausible.io/js/script.js',
+ 'https://plausible.example.com/js/script.js',
);
expect(scriptTag).toHaveAttribute('defer');
});