From c5f883ad835bbdc98669cdeac1e3748e4be90d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Alby?= Date: Thu, 16 Sep 2021 10:47:37 +0200 Subject: [PATCH] Merge pull request #5031 from overleaf/ab-paywall-events Merge paywall-prompt and paywall-click events GitOrigin-RevId: d567631d08b89565f9a3049f9b88cc2d14a799c1 --- .../web/frontend/js/ide/pdf/controllers/PdfController.js | 4 +++- .../ide/review-panel/controllers/ReviewPanelController.js | 4 +++- services/web/frontend/js/main/account-upgrade.js | 4 ++-- .../js/shared/components/start-free-trial-button.js | 4 ++-- .../components/share-project-modal.test.js | 6 +++++- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/services/web/frontend/js/ide/pdf/controllers/PdfController.js b/services/web/frontend/js/ide/pdf/controllers/PdfController.js index 44c16ced0e..09cb84ba56 100644 --- a/services/web/frontend/js/ide/pdf/controllers/PdfController.js +++ b/services/web/frontend/js/ide/pdf/controllers/PdfController.js @@ -435,7 +435,9 @@ App.controller( 'editor-click-feature', 'compile-timeout' ) - eventTracking.sendMB('compile-timeout-paywall-prompt') + eventTracking.sendMB('paywall-prompt', { + 'paywall-type': 'compile-timeout', + }) } } else if (response.status === 'terminated') { $scope.pdf.view = 'errors' diff --git a/services/web/frontend/js/ide/review-panel/controllers/ReviewPanelController.js b/services/web/frontend/js/ide/review-panel/controllers/ReviewPanelController.js index fe22fd4eb0..2ec1ed5439 100644 --- a/services/web/frontend/js/ide/review-panel/controllers/ReviewPanelController.js +++ b/services/web/frontend/js/ide/review-panel/controllers/ReviewPanelController.js @@ -917,7 +917,9 @@ export default App.controller( 'editor-click-feature', 'real-time-track-changes' ) - eventTracking.sendMB('track-changes-paywall-prompt') + eventTracking.sendMB('paywall-prompt', { + 'paywall-type': 'track-changes', + }) } const _setUserTCState = function (userId, newValue, isLocal) { diff --git a/services/web/frontend/js/main/account-upgrade.js b/services/web/frontend/js/main/account-upgrade.js index e74b88a1c6..785c149bed 100644 --- a/services/web/frontend/js/main/account-upgrade.js +++ b/services/web/frontend/js/main/account-upgrade.js @@ -9,7 +9,7 @@ function startFreeTrial(source, version, $scope) { if (typeof ga === 'function') { ga('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source) } - eventTracking.sendMB(`${source}-paywall-click`) + eventTracking.sendMB('paywall-click', { 'paywall-type': source }) url = `/user/subscription/new?planCode=${plan}&ssp=true` url = `${url}&itm_campaign=${source}` @@ -46,7 +46,7 @@ function upgradePlan(source, $scope) { } function paywallPrompt(source) { - eventTracking.sendMB(`${source}-paywall-prompt`) + eventTracking.sendMB('paywall-prompt', { 'paywall-type': source }) } export { startFreeTrial, upgradePlan, paywallPrompt } diff --git a/services/web/frontend/js/shared/components/start-free-trial-button.js b/services/web/frontend/js/shared/components/start-free-trial-button.js index 82dd579d46..3a855d19a2 100644 --- a/services/web/frontend/js/shared/components/start-free-trial-button.js +++ b/services/web/frontend/js/shared/components/start-free-trial-button.js @@ -14,7 +14,7 @@ export default function StartFreeTrialButton({ const { t } = useTranslation() useEffect(() => { - eventTracking.sendMB(`${source}-paywall-prompt`) + eventTracking.sendMB('paywall-prompt', { 'paywall-type': source }) }, [source]) const handleClick = useCallback( @@ -22,7 +22,7 @@ export default function StartFreeTrialButton({ event.preventDefault() eventTracking.send('subscription-funnel', 'upgraded-free-trial', source) - eventTracking.sendMB(`${source}-paywall-click`) + eventTracking.sendMB('paywall-click', { 'paywall-type': source }) if (setStartedFreeTrial) { setStartedFreeTrial(true) diff --git a/services/web/test/frontend/features/share-project-modal/components/share-project-modal.test.js b/services/web/test/frontend/features/share-project-modal/components/share-project-modal.test.js index 6bbcb52516..63b18d996d 100644 --- a/services/web/test/frontend/features/share-project-modal/components/share-project-modal.test.js +++ b/services/web/test/frontend/features/share-project-modal/components/share-project-modal.test.js @@ -612,7 +612,11 @@ describe('', function () { }) it('displays a message when the collaborator limit is reached', async function () { - fetchMock.post('/event/project-sharing-paywall-prompt', {}) + fetchMock.post( + '/event/paywall-prompt', + {}, + { body: { 'paywall-type': 'project-sharing' } } + ) renderWithEditorContext(, { user: {