From cb31bcaf8e169c77cab9cee5b737ec96285ada21 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Fri, 26 Apr 2024 05:19:42 +1000 Subject: [PATCH] Remove special-cased injected Google Analytics tag (#9787) - #9779 introduced (incorrect) detection to determine when to inject the Google Analytics tag. Instead, it should be injected by CI, because sending Google Analytics events is undesirable in development mode. # Important Notes None --- .github/workflows/gui.yml | 6 ++++++ .github/workflows/release.yml | 4 ++++ app/ide-desktop/lib/common/src/appConfig.js | 10 ---------- build/build/src/ci_gen/job.rs | 1 + build/build/src/ide/web.rs | 3 +++ 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/gui.yml b/.github/workflows/gui.yml index 806d2df8aa2f..a864ca775434 100644 --- a/.github/workflows/gui.yml +++ b/.github/workflows/gui.yml @@ -193,6 +193,7 @@ jobs: ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }} ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }} ENSO_CLOUD_ENVIRONMENT: ${{ vars.ENSO_CLOUD_ENVIRONMENT }} + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }} ENSO_CLOUD_REDIRECT: ${{ vars.ENSO_CLOUD_REDIRECT }} ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }} ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }} @@ -247,6 +248,7 @@ jobs: ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }} ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }} ENSO_CLOUD_ENVIRONMENT: ${{ vars.ENSO_CLOUD_ENVIRONMENT }} + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }} ENSO_CLOUD_REDIRECT: ${{ vars.ENSO_CLOUD_REDIRECT }} ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }} ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }} @@ -302,6 +304,7 @@ jobs: ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }} ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }} ENSO_CLOUD_ENVIRONMENT: ${{ vars.ENSO_CLOUD_ENVIRONMENT }} + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }} ENSO_CLOUD_REDIRECT: ${{ vars.ENSO_CLOUD_REDIRECT }} ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }} ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }} @@ -359,6 +362,7 @@ jobs: ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }} ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }} ENSO_CLOUD_ENVIRONMENT: ${{ vars.ENSO_CLOUD_ENVIRONMENT }} + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }} ENSO_CLOUD_REDIRECT: ${{ vars.ENSO_CLOUD_REDIRECT }} ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }} ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }} @@ -428,6 +432,7 @@ jobs: ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }} ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }} ENSO_CLOUD_ENVIRONMENT: ${{ vars.ENSO_CLOUD_ENVIRONMENT }} + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }} ENSO_CLOUD_REDIRECT: ${{ vars.ENSO_CLOUD_REDIRECT }} ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }} ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }} @@ -485,6 +490,7 @@ jobs: ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }} ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }} ENSO_CLOUD_ENVIRONMENT: ${{ vars.ENSO_CLOUD_ENVIRONMENT }} + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }} ENSO_CLOUD_REDIRECT: ${{ vars.ENSO_CLOUD_REDIRECT }} ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }} ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b5ee3d07fa3..96ce2ccec5dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -389,6 +389,7 @@ jobs: ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }} ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }} ENSO_CLOUD_ENVIRONMENT: ${{ vars.ENSO_CLOUD_ENVIRONMENT }} + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }} ENSO_CLOUD_REDIRECT: ${{ vars.ENSO_CLOUD_REDIRECT }} ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }} ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }} @@ -464,6 +465,7 @@ jobs: ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }} ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }} ENSO_CLOUD_ENVIRONMENT: ${{ vars.ENSO_CLOUD_ENVIRONMENT }} + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }} ENSO_CLOUD_REDIRECT: ${{ vars.ENSO_CLOUD_REDIRECT }} ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }} ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }} @@ -537,6 +539,7 @@ jobs: ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }} ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }} ENSO_CLOUD_ENVIRONMENT: ${{ vars.ENSO_CLOUD_ENVIRONMENT }} + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }} ENSO_CLOUD_REDIRECT: ${{ vars.ENSO_CLOUD_REDIRECT }} ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }} ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }} @@ -598,6 +601,7 @@ jobs: ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }} ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }} ENSO_CLOUD_ENVIRONMENT: ${{ vars.ENSO_CLOUD_ENVIRONMENT }} + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }} ENSO_CLOUD_REDIRECT: ${{ vars.ENSO_CLOUD_REDIRECT }} ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }} ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }} diff --git a/app/ide-desktop/lib/common/src/appConfig.js b/app/ide-desktop/lib/common/src/appConfig.js index eea34420e9f4..441e0f3d2058 100644 --- a/app/ide-desktop/lib/common/src/appConfig.js +++ b/app/ide-desktop/lib/common/src/appConfig.js @@ -3,12 +3,6 @@ import * as fs from 'node:fs/promises' import * as path from 'node:path' import * as url from 'node:url' -// ================= -// === Constants === -// ================= - -const ENSO_CLOUD_GOOGLE_ANALYTICS_TAG = 'G-CLTBJ37MDM' - // =============================== // === readEnvironmentFromFile === // =============================== @@ -41,10 +35,6 @@ export async function readEnvironmentFromFile() { } const variables = Object.fromEntries(entries) Object.assign(process.env, variables) - if (!('' in process.env)) { - // @ts-expect-error This is the only place where this environment variable is set. - process.env.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG = ENSO_CLOUD_GOOGLE_ANALYTICS_TAG - } } catch (error) { if (isProduction) { console.warn('Could not load `.env` file; disabling cloud backend.') diff --git a/build/build/src/ci_gen/job.rs b/build/build/src/ci_gen/job.rs index 75cc4b08b5de..f570d33f2a14 100644 --- a/build/build/src/ci_gen/job.rs +++ b/build/build/src/ci_gen/job.rs @@ -145,6 +145,7 @@ pub fn expose_cloud_vars(step: Step) -> Step { .with_variable_exposed(ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID) .with_variable_exposed(ENSO_CLOUD_COGNITO_DOMAIN) .with_variable_exposed(ENSO_CLOUD_COGNITO_REGION) + .with_variable_exposed(ENSO_CLOUD_GOOGLE_ANALYTICS_TAG) } /// Expose variables for the GUI build. diff --git a/build/build/src/ide/web.rs b/build/build/src/ide/web.rs index d060dd6fac2f..028c99532040 100644 --- a/build/build/src/ide/web.rs +++ b/build/build/src/ide/web.rs @@ -133,6 +133,9 @@ pub mod env { /// The AWS region for Amplify configuration, matching the domain region. ENSO_CLOUD_COGNITO_REGION, String; + + /// The Google Analytics tag to which Google Analytics events should be sent. + ENSO_CLOUD_GOOGLE_ANALYTICS_TAG, String; } // GUI-specific environment variables