From 6895d931215f86c2d802cc0d465d2e5af92bba01 Mon Sep 17 00:00:00 2001 From: Alexander Eichhorn Date: Tue, 12 May 2026 17:19:33 +0200 Subject: [PATCH 1/3] docs: load Plausible on invoke.ai (custom), not ghpages Plausible was being injected on the ghpages target, which redirects to invoke.ai and therefore never serves analytics. Flip the conditional so the script loads on the actual production custom-domain build. --- docs/astro.config.mjs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index deb4ba47093..10240346792 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -81,21 +81,22 @@ export default defineConfig({ baseUrl: 'https://github.com/invoke-ai/InvokeAI/edit/main/docs', }, head: isGhPages - ? [ - { - tag: 'script', - attrs: { - async: true, - src: 'https://plausible.tracking.events/js/pa-BHcumuOemKz4XIQeWkTn4.js', - }, + ? [] + : + [ + { + tag: 'script', + attrs: { + async: true, + src: 'https://plausible.tracking.events/js/pa-BHcumuOemKz4XIQeWkTn4.js', }, - { - tag: 'script', - content: - 'window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()', - }, - ] - : [], + }, + { + tag: 'script', + content: + 'window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()', + }, + ], defaultLocale: 'root', locales: { root: { From 416bb6a5fd89571321dfaaa9f652ac055b30876e Mon Sep 17 00:00:00 2001 From: Alexander Eichhorn Date: Wed, 13 May 2026 00:13:05 +0200 Subject: [PATCH 2/3] docs: gate Plausible on ENABLE_ANALYTICS env var Only inject the tracking script when ENABLE_ANALYTICS=true, which the deploy workflow sets exclusively on main-branch pushes. Keeps local builds, PR builds, and manual workflow_dispatch runs analytics-free. --- .github/workflows/deploy-docs.yml | 1 + docs/astro.config.mjs | 35 ++++++++++++++++--------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index c80b69bc2a4..e79aaa91ab4 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -116,6 +116,7 @@ jobs: working-directory: docs env: DEPLOY_TARGET: ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_target || 'custom' }} + ENABLE_ANALYTICS: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: verify deploy output diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 10240346792..524c6459878 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -14,6 +14,7 @@ import starlightContextualMenu from 'starlight-contextual-menu'; // so the same source can be deployed to either target. const deployTarget = process.env.DEPLOY_TARGET ?? 'custom'; const isGhPages = deployTarget === 'ghpages'; +const enableAnalytics = process.env.ENABLE_ANALYTICS === 'true'; const base = isGhPages ? '/InvokeAI' : ''; const withBase = (/** @type {string} */ path) => (isGhPages ? `${base}${path}` : path); @@ -80,23 +81,23 @@ export default defineConfig({ editLink: { baseUrl: 'https://github.com/invoke-ai/InvokeAI/edit/main/docs', }, - head: isGhPages - ? [] - : - [ - { - tag: 'script', - attrs: { - async: true, - src: 'https://plausible.tracking.events/js/pa-BHcumuOemKz4XIQeWkTn4.js', - }, - }, - { - tag: 'script', - content: - 'window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()', - }, - ], + head: + enableAnalytics && !isGhPages + ? [ + { + tag: 'script', + attrs: { + async: true, + src: 'https://plausible.tracking.events/js/pa-BHcumuOemKz4XIQeWkTn4.js', + }, + }, + { + tag: 'script', + content: + 'window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()', + }, + ] + : [], defaultLocale: 'root', locales: { root: { From a6543c94859858789cb8db9ca8f9d73eaff77ca5 Mon Sep 17 00:00:00 2001 From: Alexander Eichhorn Date: Wed, 13 May 2026 12:36:25 +0200 Subject: [PATCH 3/3] Update .github/workflows/deploy-docs.yml Co-authored-by: Josh Corbett --- .github/workflows/deploy-docs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index e79aaa91ab4..8c4a477fe9f 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -116,7 +116,8 @@ jobs: working-directory: docs env: DEPLOY_TARGET: ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_target || 'custom' }} - ENABLE_ANALYTICS: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + ENABLE_ANALYTICS: ${{ github.ref == 'refs/heads/main' && (github.event_name != 'workflow_dispatch' || + inputs.deploy_target == 'custom') }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: verify deploy output