From 3cee5509e61ef335f2ef86c9d98fc7d1eca9f832 Mon Sep 17 00:00:00 2001 From: Ahmad Abdolsaheb Date: Wed, 2 Feb 2022 19:34:24 +0300 Subject: [PATCH] chore(client): add view_type meta to analytics (#44999) --- client/src/redux/ga-saga.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client/src/redux/ga-saga.js b/client/src/redux/ga-saga.js index 42c7fa71e8..51fd0b96f0 100644 --- a/client/src/redux/ga-saga.js +++ b/client/src/redux/ga-saga.js @@ -5,7 +5,8 @@ import ga from '../analytics'; import { emailSelector, completionCountSelector, - completedChallengesSelector + completedChallengesSelector, + recentlyClaimedBlockSelector } from '../redux'; import { emailToABVariant } from '../utils/A-B-tester'; @@ -21,6 +22,14 @@ function* callGaType({ payload: { type, data } }) { if (email) { const completedChallengeTotal = yield select(completedChallengesSelector); const completedChallengeSession = yield select(completionCountSelector); + let viewType = null; + + // set the modal type + if (data.action.includes('Modal')) { + const recentlyClaimedBlock = yield select(recentlyClaimedBlockSelector); + viewType = recentlyClaimedBlock ? 'block' : 'progress'; + } + const customDimensions = { // URL; dimension1: window.location.href, @@ -31,7 +40,9 @@ function* callGaType({ payload: { type, data } }) { // Test_Type dimension4: aBTestConfig.type, // Test_Variation - dimension5: emailToABVariant(email).isAVariant ? 'A' : 'B' + dimension5: emailToABVariant(email).isAVariant ? 'A' : 'B', + // View_Type + dimension6: viewType }; ga.set(customDimensions); }