From 0d645c87ffb98ab8b75959f4d1e0d6edf17e20f6 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 23 Jul 2020 22:27:59 -0400 Subject: [PATCH 1/8] Delete unnecesssary ping params --- app/hub/Views/UpgradePlanView/UpgradePlanView.jsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx b/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx index f4a70019b..a5bddb08d 100644 --- a/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx +++ b/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx @@ -166,16 +166,10 @@ const UpgradePlanView = (props) => { mobileComparisonTableRef.current.scrollIntoView({ behavior: 'smooth' }); }; - // UTM params - const signedIn = +!!user; - const subscriptionType = () => { - if (isPremium) return 'PREMIUM'; - if (isPlus) return 'SUPPORTER'; - return '-1'; - }; - // Interval is the query Param to show monthly/yearly pricing in checkout web, also used as a ping parameter + // UTM and Query Params + // Subscription_interval is the query param to show monthly/yearly pricing in checkout web const interval = show_yearly_prices ? 'year' : 'month'; - const utmParams = `utm_source=gbe&signedIn=${signedIn}&st=${subscriptionType()}&subscription_interval=${interval}`; + const utmParams = `utm_source=gbe&subscription_interval=${interval}`; const plusCTAButton = (position) => { const utm_campaign = position === 'top' ? 'c_1' : 'c_2'; From 6d1d37b3670c3ccd25a5cf8e943fedc4826e6da2 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 26 Jul 2020 22:39:48 -0400 Subject: [PATCH 2/8] Add subscription interval to ping params --- src/classes/Metrics.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/classes/Metrics.js b/src/classes/Metrics.js index 13a1efa62..b90ce464f 100644 --- a/src/classes/Metrics.js +++ b/src/classes/Metrics.js @@ -371,6 +371,8 @@ class Metrics { // New parameter for Ghostery 8.5.2 // Hub Promo variant `&hp=${encodeURIComponent(Metrics._getHubPromoVariant().toString())}`; + // Subscription Interval + `&si=${encodeURIComponent(Metrics._getSubscriptionInterval().toString())}`; if (CAMPAIGN_METRICS.includes(type)) { // only send campaign attribution when necessary @@ -550,6 +552,27 @@ class Metrics { } } + /** + * Get the Int associated with the users subscription interval + * @private + * @return {number} String associated with the users subscription interval + */ + static _getSubscriptionInterval() { + const subscriptionInterval = conf && conf.account && conf.account.subscriptionData && conf.account.subscriptionData.planInterval; + + if (subscriptionInterval) { + switch (subscriptionInterval) { + case 'month': + return 1; + case 'year': + return 2; + default: + return 0; + } + } + return 0; + } + /** * Calculate remaining scheduled time for a ping * From 247554f192936970158c87fc5146bc8027057ad1 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 26 Jul 2020 22:49:38 -0400 Subject: [PATCH 3/8] Change subscription_interval to interval to match the query param in checkout web --- app/hub/Views/UpgradePlanView/UpgradePlanView.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx b/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx index a5bddb08d..3caf0241b 100644 --- a/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx +++ b/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx @@ -169,7 +169,7 @@ const UpgradePlanView = (props) => { // UTM and Query Params // Subscription_interval is the query param to show monthly/yearly pricing in checkout web const interval = show_yearly_prices ? 'year' : 'month'; - const utmParams = `utm_source=gbe&subscription_interval=${interval}`; + const utmParams = `utm_source=gbe&interval=${interval}`; const plusCTAButton = (position) => { const utm_campaign = position === 'top' ? 'c_1' : 'c_2'; From e873160d0228357566e928c6f2dfb0913b232245 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 26 Jul 2020 22:53:57 -0400 Subject: [PATCH 4/8] Remove null check --- src/classes/Metrics.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/classes/Metrics.js b/src/classes/Metrics.js index b90ce464f..27d9ac6dc 100644 --- a/src/classes/Metrics.js +++ b/src/classes/Metrics.js @@ -560,17 +560,14 @@ class Metrics { static _getSubscriptionInterval() { const subscriptionInterval = conf && conf.account && conf.account.subscriptionData && conf.account.subscriptionData.planInterval; - if (subscriptionInterval) { - switch (subscriptionInterval) { - case 'month': - return 1; - case 'year': - return 2; - default: - return 0; - } + switch (subscriptionInterval) { + case 'month': + return 1; + case 'year': + return 2; + default: + return 0; } - return 0; } /** From 23fb87b2ccccaf67c8741e02c1c759f81b639d23 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 26 Jul 2020 22:57:06 -0400 Subject: [PATCH 5/8] Change variable name --- app/hub/Views/UpgradePlanView/UpgradePlanView.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx b/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx index 3caf0241b..bdc3980b7 100644 --- a/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx +++ b/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx @@ -169,11 +169,11 @@ const UpgradePlanView = (props) => { // UTM and Query Params // Subscription_interval is the query param to show monthly/yearly pricing in checkout web const interval = show_yearly_prices ? 'year' : 'month'; - const utmParams = `utm_source=gbe&interval=${interval}`; + const params = `utm_source=gbe&interval=${interval}`; const plusCTAButton = (position) => { const utm_campaign = position === 'top' ? 'c_1' : 'c_2'; - const plusCheckoutLink = `${globals.CHECKOUT_BASE_URL}/plus?${utmParams}&utm_campaign=intro_hub_${utm_campaign}`; + const plusCheckoutLink = `${globals.CHECKOUT_BASE_URL}/plus?${params}&utm_campaign=intro_hub_${utm_campaign}`; return ( @@ -184,7 +184,7 @@ const UpgradePlanView = (props) => { const premiumCTAButton = (position) => { const utm_campaign = position === 'top' ? 'c_3' : 'c_4'; - const premiumCheckoutLink = `${globals.CHECKOUT_BASE_URL}/premium?${utmParams}&utm_campaign=intro_hub_${utm_campaign}`; + const premiumCheckoutLink = `${globals.CHECKOUT_BASE_URL}/premium?${params}&utm_campaign=intro_hub_${utm_campaign}`; return ( From 6f72d1b3bc2883c3c602d8186a28c386082ba0ab Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 26 Jul 2020 23:02:04 -0400 Subject: [PATCH 6/8] Fix linter --- src/classes/Metrics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classes/Metrics.js b/src/classes/Metrics.js index 27d9ac6dc..beb00d7eb 100644 --- a/src/classes/Metrics.js +++ b/src/classes/Metrics.js @@ -370,7 +370,7 @@ class Metrics { // New parameter for Ghostery 8.5.2 // Hub Promo variant - `&hp=${encodeURIComponent(Metrics._getHubPromoVariant().toString())}`; + `&hp=${encodeURIComponent(Metrics._getHubPromoVariant().toString())}` + // Subscription Interval `&si=${encodeURIComponent(Metrics._getSubscriptionInterval().toString())}`; From f554c7de60a4c8397a3da9975102fb85e855b85b Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 27 Jul 2020 11:14:14 -0400 Subject: [PATCH 7/8] Update comment. Wrap ternary in (), update subscripton_interval ping param name --- app/hub/Views/UpgradePlanView/UpgradePlanView.jsx | 6 +++--- src/background.js | 2 +- src/classes/Metrics.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx b/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx index bdc3980b7..d3515c418 100644 --- a/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx +++ b/app/hub/Views/UpgradePlanView/UpgradePlanView.jsx @@ -167,12 +167,12 @@ const UpgradePlanView = (props) => { }; // UTM and Query Params - // Subscription_interval is the query param to show monthly/yearly pricing in checkout web + // interval is the query param to show monthly/yearly pricing in checkout web const interval = show_yearly_prices ? 'year' : 'month'; const params = `utm_source=gbe&interval=${interval}`; const plusCTAButton = (position) => { - const utm_campaign = position === 'top' ? 'c_1' : 'c_2'; + const utm_campaign = (position === 'top' ? 'c_1' : 'c_2'); const plusCheckoutLink = `${globals.CHECKOUT_BASE_URL}/plus?${params}&utm_campaign=intro_hub_${utm_campaign}`; return ( @@ -183,7 +183,7 @@ const UpgradePlanView = (props) => { }; const premiumCTAButton = (position) => { - const utm_campaign = position === 'top' ? 'c_3' : 'c_4'; + const utm_campaign = (position === 'top' ? 'c_3' : 'c_4'); const premiumCheckoutLink = `${globals.CHECKOUT_BASE_URL}/premium?${params}&utm_campaign=intro_hub_${utm_campaign}`; return ( diff --git a/src/background.js b/src/background.js index 3acd6b4c0..e9762b3cf 100644 --- a/src/background.js +++ b/src/background.js @@ -823,7 +823,7 @@ function onMessageHandler(request, sender, callback) { .catch((err) => { log('LOGIN ERROR', err); callback({ errors: _getJSONAPIErrorsObject(err) }); - }); + }) return true; } if (name === 'account.register') { diff --git a/src/classes/Metrics.js b/src/classes/Metrics.js index beb00d7eb..0578ddfc0 100644 --- a/src/classes/Metrics.js +++ b/src/classes/Metrics.js @@ -372,7 +372,7 @@ class Metrics { // Hub Promo variant `&hp=${encodeURIComponent(Metrics._getHubPromoVariant().toString())}` + // Subscription Interval - `&si=${encodeURIComponent(Metrics._getSubscriptionInterval().toString())}`; + `&subscription_interval=${encodeURIComponent(Metrics._getSubscriptionInterval().toString())}`; if (CAMPAIGN_METRICS.includes(type)) { // only send campaign attribution when necessary From 2574305ac6e14cb2274e5617b7d8c61857136aff Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 27 Jul 2020 11:17:37 -0400 Subject: [PATCH 8/8] Add semicolon --- src/background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index e9762b3cf..3acd6b4c0 100644 --- a/src/background.js +++ b/src/background.js @@ -823,7 +823,7 @@ function onMessageHandler(request, sender, callback) { .catch((err) => { log('LOGIN ERROR', err); callback({ errors: _getJSONAPIErrorsObject(err) }); - }) + }); return true; } if (name === 'account.register') {