From 97bed86dd179b0d4dafe533ccf13ba4fa0d1c4ec Mon Sep 17 00:00:00 2001 From: nikolaTrichkovski Date: Mon, 18 Nov 2024 08:53:24 +0100 Subject: [PATCH 01/11] fix structure for GoogleTagManager config --- waiter/config.ru | 5 +++- waiter/lib/travis/web/app.rb | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/waiter/config.ru b/waiter/config.ru index f20c97cfd3..5249c31b15 100644 --- a/waiter/config.ru +++ b/waiter/config.ru @@ -131,6 +131,9 @@ run Travis::Web::App.build( enable_feature_flags: ENV['ENABLE_FEATURE_FLAGS'], stripe_publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'], default_provider: ENV['DEFAULT_PROVIDER'], - log_limit: ENV['LOG_LIMIT'] + log_limit: ENV['LOG_LIMIT'], + auth_endpoint: ENV['AUTH_ENDPOINT'], + api_trace_endpoint: ENV['API_TRACE_ENDPOINT'], + intercom_app_id: ENV['INTERCOM_APP_ID'] ) end diff --git a/waiter/lib/travis/web/app.rb b/waiter/lib/travis/web/app.rb index 96cc1c76df..cef8a19c54 100644 --- a/waiter/lib/travis/web/app.rb +++ b/waiter/lib/travis/web/app.rb @@ -204,6 +204,10 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit config['featureFlags']['enterprise-version'] = true end + if ENV['REDIRECT'] + config['featureFlags']['redirect'] = true + end + if options[:github_apps_app_name] config['githubApps'] ||= {} config['githubApps']['appName'] = options[:github_apps_app_name] @@ -222,6 +226,8 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit config['defaultTitle'] = title config['apiEndpoint'] = options[:api_endpoint] if options[:api_endpoint] + config['authEndpoint'] = options[:auth_endpoint] if options[:auth_endpoint] + config['apiTraceEndpoint'] = options[:api_trace_endpoint] if options[:api_trace_endpoint] config['githubAppsEndpoint'] = options[:github_apps_endpoint] source_endpoint = options[:source_endpoint] if source_endpoint @@ -262,6 +268,10 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit config['providers'][provider]['isDefault'] = true end + config['intercom'] ||= {} + config['intercom']['appid']= options[:intercom_app_id] || 'placeholder' + config['intercom']['enabled'] = !!options[:intercom_app_id] + if ENV['ENDPOINT_PORTFOLIO'] config['providers'] ||= {} config['providers']['assembla'] ||= {} @@ -286,10 +296,48 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit config['disableAida'] = ENV['DISABLE_AIDA'] end + config['metricsAdapters'] = [] + + if ENV['GOOGLE_ANALYTICS_ID'] + config['metricsAdapters'].push({ + name: 'GoogleAnalytics', + environments: ['development', 'production'], + config: { + id: ENV['GOOGLE_ANALYTICS_ID'], + debug: @options[:environment] === 'development', + trace: @options[:environment] === 'development', + sendHitTask: @options[:environment] != 'development', + } + }) + end + + if ENV['GOOGLE_TAGS_CONTAINER_ID'] + config['metricsAdapters'].push({ + name: 'GoogleTagManager', + environments: ['development', 'production'], + config: { + id: ENV['GOOGLE_TAGS_CONTAINER_ID'] + } + }) + end + + config['gReCaptcha'] ||= {} + if ENV['GOOGLE_RECAPTCHA_SITE_KEY'] + config['gReCaptcha']['siteKey'] = ENV['GOOGLE_RECAPTCHA_SITE_KEY'] + end + if ENV['TRIAL_DAYS'] config['trialDays'] = ENV['TRIAL_DAYS'] end + if ENV['DISABLE_SENTRY'] + config['sentry']['development'] = true + end + + config['tempBanner'] ||= {} + config['tempBanner']['tempBannerEnabled'] = ENV['TEMPORARY_ANNOUNCEMENT_BANNER_ENABLED'] || false + config['tempBanner']['tempBannerMessage'] = ENV['TEMPORARY_ANNOUNCEMENT_MESSAGE'] || '' + regexp = %r{ Date: Mon, 18 Nov 2024 12:32:59 +0100 Subject: [PATCH 02/11] add envParams for GoogleTagManager --- waiter/lib/travis/web/app.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/waiter/lib/travis/web/app.rb b/waiter/lib/travis/web/app.rb index cef8a19c54..0f370ac0d3 100644 --- a/waiter/lib/travis/web/app.rb +++ b/waiter/lib/travis/web/app.rb @@ -316,7 +316,8 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit name: 'GoogleTagManager', environments: ['development', 'production'], config: { - id: ENV['GOOGLE_TAGS_CONTAINER_ID'] + id: ENV['GOOGLE_TAGS_CONTAINER_ID'], + envParams: ENV['GOOGLE_TAGS_ENV_PARAMS'] } }) end From 0851fdfd33cb0927e060964580f6a240aaf9644d Mon Sep 17 00:00:00 2001 From: nikolaTrichkovski Date: Mon, 18 Nov 2024 12:59:33 +0100 Subject: [PATCH 03/11] correct name --- waiter/lib/travis/web/app.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waiter/lib/travis/web/app.rb b/waiter/lib/travis/web/app.rb index 0f370ac0d3..fff018e400 100644 --- a/waiter/lib/travis/web/app.rb +++ b/waiter/lib/travis/web/app.rb @@ -317,7 +317,7 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit environments: ['development', 'production'], config: { id: ENV['GOOGLE_TAGS_CONTAINER_ID'], - envParams: ENV['GOOGLE_TAGS_ENV_PARAMS'] + envParams: ENV['GOOGLE_TAGS_PARAMS'] } }) end From 03cfc94410bf1f407c278608e1800ed7f5e15cac Mon Sep 17 00:00:00 2001 From: nikolaTrichkovski Date: Mon, 18 Nov 2024 13:46:06 +0100 Subject: [PATCH 04/11] remove envParams from waiter --- waiter/lib/travis/web/app.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/waiter/lib/travis/web/app.rb b/waiter/lib/travis/web/app.rb index fff018e400..cef8a19c54 100644 --- a/waiter/lib/travis/web/app.rb +++ b/waiter/lib/travis/web/app.rb @@ -316,8 +316,7 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit name: 'GoogleTagManager', environments: ['development', 'production'], config: { - id: ENV['GOOGLE_TAGS_CONTAINER_ID'], - envParams: ENV['GOOGLE_TAGS_PARAMS'] + id: ENV['GOOGLE_TAGS_CONTAINER_ID'] } }) end From 8bafa58a736e308f3ebd34e629a3aec7097f370c Mon Sep 17 00:00:00 2001 From: nikolaTrichkovski Date: Mon, 18 Nov 2024 14:47:16 +0100 Subject: [PATCH 05/11] comment travkButtonClicks --- app/components/billing/process.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/components/billing/process.js b/app/components/billing/process.js index e4eb94c015..347729653b 100644 --- a/app/components/billing/process.js +++ b/app/components/billing/process.js @@ -49,10 +49,10 @@ export default Component.extend({ trackButtonClicks() { if (this.currentStep === STEPS.ONE) { - this.metrics.trackEvent({ - category: 'Subscription', - action: 'Plan Chosen', - }); + // this.metrics.trackEvent({ + // category: 'Subscription', + // action: 'Plan Chosen', + // }); } else if (this.currentStep === STEPS.TWO) { this.metrics.trackEvent({ category: 'Subscription', @@ -82,7 +82,7 @@ export default Component.extend({ next() { if (this.selectedPlan || this.selectedAddon) { - this.trackButtonClicks(); + // this.trackButtonClicks(); const currentIndex = this.steps.indexOf(this.currentStep); const lastIndex = this.steps.length - 1; const nextIndex = Math.min(lastIndex, currentIndex + 1); From 5d322e391e3edac40194adad621b5d44c57d4ad9 Mon Sep 17 00:00:00 2001 From: nikolaTrichkovski Date: Mon, 18 Nov 2024 16:57:32 +0100 Subject: [PATCH 06/11] rever remove tracker --- app/components/billing/process.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/components/billing/process.js b/app/components/billing/process.js index 347729653b..e4eb94c015 100644 --- a/app/components/billing/process.js +++ b/app/components/billing/process.js @@ -49,10 +49,10 @@ export default Component.extend({ trackButtonClicks() { if (this.currentStep === STEPS.ONE) { - // this.metrics.trackEvent({ - // category: 'Subscription', - // action: 'Plan Chosen', - // }); + this.metrics.trackEvent({ + category: 'Subscription', + action: 'Plan Chosen', + }); } else if (this.currentStep === STEPS.TWO) { this.metrics.trackEvent({ category: 'Subscription', @@ -82,7 +82,7 @@ export default Component.extend({ next() { if (this.selectedPlan || this.selectedAddon) { - // this.trackButtonClicks(); + this.trackButtonClicks(); const currentIndex = this.steps.indexOf(this.currentStep); const lastIndex = this.steps.length - 1; const nextIndex = Math.min(lastIndex, currentIndex + 1); From 9276705297108ee7a695fab348e8349331f89dae Mon Sep 17 00:00:00 2001 From: nikolaTrichkovski Date: Mon, 18 Nov 2024 17:25:09 +0100 Subject: [PATCH 07/11] refactor --- waiter/lib/travis/web/app.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/waiter/lib/travis/web/app.rb b/waiter/lib/travis/web/app.rb index cef8a19c54..a7844c7b09 100644 --- a/waiter/lib/travis/web/app.rb +++ b/waiter/lib/travis/web/app.rb @@ -304,9 +304,10 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit environments: ['development', 'production'], config: { id: ENV['GOOGLE_ANALYTICS_ID'], - debug: @options[:environment] === 'development', - trace: @options[:environment] === 'development', - sendHitTask: @options[:environment] != 'development', + debug: false, # Force to false in production + trace: false, # Force to false in production + sendHitTask: true, # Force to true in production + anonymizeIp: true # Best practice for GDPR } }) end @@ -316,7 +317,10 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit name: 'GoogleTagManager', environments: ['development', 'production'], config: { - id: ENV['GOOGLE_TAGS_CONTAINER_ID'] + id: ENV['GOOGLE_TAGS_CONTAINER_ID'], + dataLayer: [], # Initialize empty dataLayer + envParams: ENV['GOOGLE_TAGS_PARAMS'], + debug: false # Force debug off in production } }) end From d324f40f5f58bf7c965f2c3c37815adb171cac98 Mon Sep 17 00:00:00 2001 From: nikolaTrichkovski Date: Mon, 18 Nov 2024 18:13:00 +0100 Subject: [PATCH 08/11] add staging --- waiter/lib/travis/web/app.rb | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/waiter/lib/travis/web/app.rb b/waiter/lib/travis/web/app.rb index a7844c7b09..9bb4fb541b 100644 --- a/waiter/lib/travis/web/app.rb +++ b/waiter/lib/travis/web/app.rb @@ -301,26 +301,22 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit if ENV['GOOGLE_ANALYTICS_ID'] config['metricsAdapters'].push({ name: 'GoogleAnalytics', - environments: ['development', 'production'], + environments: ['development', 'production', 'staging'], config: { id: ENV['GOOGLE_ANALYTICS_ID'], - debug: false, # Force to false in production - trace: false, # Force to false in production - sendHitTask: true, # Force to true in production - anonymizeIp: true # Best practice for GDPR + debug: @options[:environment] === 'development', + trace: @options[:environment] === 'development', + sendHitTask: @options[:environment] != 'development' } }) end - if ENV['GOOGLE_TAGS_CONTAINER_ID'] config['metricsAdapters'].push({ name: 'GoogleTagManager', - environments: ['development', 'production'], + environments: ['development', 'production', 'staging'], config: { id: ENV['GOOGLE_TAGS_CONTAINER_ID'], - dataLayer: [], # Initialize empty dataLayer - envParams: ENV['GOOGLE_TAGS_PARAMS'], - debug: false # Force debug off in production + envParams: ENV['GOOGLE_TAGS_ENV_PARAMS'] } }) end From 54d5fa8e82f2a204e9bfee353e9d5c5357160448 Mon Sep 17 00:00:00 2001 From: nikolaTrichkovski Date: Mon, 18 Nov 2024 18:38:09 +0100 Subject: [PATCH 09/11] add debug --- waiter/lib/travis/web/app.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/waiter/lib/travis/web/app.rb b/waiter/lib/travis/web/app.rb index 9bb4fb541b..a3f937b7ad 100644 --- a/waiter/lib/travis/web/app.rb +++ b/waiter/lib/travis/web/app.rb @@ -301,22 +301,25 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit if ENV['GOOGLE_ANALYTICS_ID'] config['metricsAdapters'].push({ name: 'GoogleAnalytics', - environments: ['development', 'production', 'staging'], + environments: ['development', 'production'], config: { id: ENV['GOOGLE_ANALYTICS_ID'], - debug: @options[:environment] === 'development', - trace: @options[:environment] === 'development', - sendHitTask: @options[:environment] != 'development' + debug: true, # Temporarily enable for debugging + trace: true, # Temporarily enable for debugging + sendHitTask: true, + anonymizeIp: true } }) end if ENV['GOOGLE_TAGS_CONTAINER_ID'] config['metricsAdapters'].push({ name: 'GoogleTagManager', - environments: ['development', 'production', 'staging'], + environments: ['development', 'production'], config: { id: ENV['GOOGLE_TAGS_CONTAINER_ID'], - envParams: ENV['GOOGLE_TAGS_ENV_PARAMS'] + dataLayer: [], + envParams: ENV['GOOGLE_TAGS_PARAMS'], + debug: true # Temporarily enable for debugging } }) end From 5a38bf302515be36e22351d2a5e76efedd124f0f Mon Sep 17 00:00:00 2001 From: nikolaTrichkovski Date: Tue, 19 Nov 2024 18:58:51 +0100 Subject: [PATCH 10/11] remove debug, revert config attributes --- waiter/lib/travis/web/app.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/waiter/lib/travis/web/app.rb b/waiter/lib/travis/web/app.rb index a3f937b7ad..81f7d8c964 100644 --- a/waiter/lib/travis/web/app.rb +++ b/waiter/lib/travis/web/app.rb @@ -304,10 +304,9 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit environments: ['development', 'production'], config: { id: ENV['GOOGLE_ANALYTICS_ID'], - debug: true, # Temporarily enable for debugging - trace: true, # Temporarily enable for debugging - sendHitTask: true, - anonymizeIp: true + debug: @options[:environment] === 'development', + trace: @options[:environment] === 'development', + sendHitTask: @options[:environment] != 'development' } }) end @@ -317,9 +316,7 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit environments: ['development', 'production'], config: { id: ENV['GOOGLE_TAGS_CONTAINER_ID'], - dataLayer: [], - envParams: ENV['GOOGLE_TAGS_PARAMS'], - debug: true # Temporarily enable for debugging + envParams: ENV['GOOGLE_TAGS_PARAMS'] } }) end From 30a1a7931453fe2ec6103419b6bf4ec8383468db Mon Sep 17 00:00:00 2001 From: nikolaTrichkovski Date: Thu, 21 Nov 2024 23:37:45 +0100 Subject: [PATCH 11/11] add empty line --- waiter/lib/travis/web/app.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/waiter/lib/travis/web/app.rb b/waiter/lib/travis/web/app.rb index 81f7d8c964..c17fc5a818 100644 --- a/waiter/lib/travis/web/app.rb +++ b/waiter/lib/travis/web/app.rb @@ -310,6 +310,7 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit } }) end + if ENV['GOOGLE_TAGS_CONTAINER_ID'] config['metricsAdapters'].push({ name: 'GoogleTagManager',