chore(client): add view_type meta to analytics (#44999)

pull/44999/merge
Ahmad Abdolsaheb 2022-02-02 19:34:24 +03:00 committed by GitHub
parent 09d30d2d14
commit 3cee5509e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -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);
}