Kaynağa Gözat

Merge pull request #29349 from overleaf/rh-compile-timeout-info-tracking

Add missing tracking to compile timeout info for default variant

GitOrigin-RevId: 4dfea0f55a1887b64e9c41d417c4a1cc0510453d
roo hutton 9 ay önce
ebeveyn
işleme
d0ba35ab8f

+ 28 - 2
services/web/frontend/js/features/ide-redesign/components/pdf-preview/pdf-error-state/compile-timeout-error-state.tsx

@@ -3,6 +3,7 @@ import MaterialIcon from '@/shared/components/material-icon'
 import { Trans, useTranslation } from 'react-i18next'
 import { useDetachCompileContext as useCompileContext } from '@/shared/context/detach-compile-context'
 import { useStopOnFirstError } from '@/shared/hooks/use-stop-on-first-error'
+import { sendMB } from '@/infrastructure/event-tracking'
 import { useCallback, useMemo } from 'react'
 import ErrorState from './error-state'
 import StartFreeTrialButton from '@/shared/components/start-free-trial-button'
@@ -149,7 +150,16 @@ const ReasonsForTimeoutInfo = () => {
               i18nKey="project_timed_out_optimize_images"
               components={[
                 // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-                <a href="https://www.overleaf.com/learn/how-to/Optimising_very_large_image_files" />,
+                <a
+                  href="https://www.overleaf.com/learn/how-to/Optimising_very_large_image_files"
+                  onClick={() => {
+                    sendMB('paywall-info-click', {
+                      'paywall-type': 'compile-timeout',
+                      content: 'docs',
+                      type: 'optimize',
+                    })
+                  }}
+                />,
               ]}
             />
           </li>
@@ -158,7 +168,16 @@ const ReasonsForTimeoutInfo = () => {
               i18nKey="a_fatal_compile_error_that_completely_blocks_compilation"
               components={[
                 // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-                <a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F#Fatal_compile_errors_blocking_the_compilation" />,
+                <a
+                  href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F#Fatal_compile_errors_blocking_the_compilation"
+                  onClick={() => {
+                    sendMB('paywall-info-click', {
+                      'paywall-type': 'compile-timeout',
+                      content: 'docs',
+                      type: 'fatal-error',
+                    })
+                  }}
+                />,
               ]}
             />
             {!lastCompileOptions.stopOnFirstError && (
@@ -191,6 +210,13 @@ const ReasonsForTimeoutInfo = () => {
                 href="/learn/how-to/Fixing_and_preventing_compile_timeouts"
                 rel="noopener noreferrer"
                 target="_blank"
+                onClick={() => {
+                  sendMB('paywall-info-click', {
+                    'paywall-type': 'compile-timeout',
+                    content: 'docs',
+                    type: 'learn-more',
+                  })
+                }}
               />,
             ]}
           />

+ 31 - 3
services/web/frontend/js/features/pdf-preview/components/pdf-preview-error.tsx

@@ -5,6 +5,7 @@ import PdfLogEntry from './pdf-log-entry'
 import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
 import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
 import getMeta from '../../../utils/meta'
+import { sendMB } from '@/infrastructure/event-tracking'
 
 function PdfPreviewError({
   error,
@@ -300,7 +301,16 @@ function TimedOutLogEntry() {
             i18nKey="project_timed_out_optimize_images"
             components={[
               // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-              <a href="https://www.overleaf.com/learn/how-to/Optimising_very_large_image_files" />,
+              <a
+                href="https://www.overleaf.com/learn/how-to/Optimising_very_large_image_files"
+                onClick={() => {
+                  sendMB('paywall-info-click', {
+                    'paywall-type': 'compile-timeout',
+                    content: 'docs',
+                    type: 'optimize',
+                  })
+                }}
+              />,
             ]}
           />
         </li>
@@ -309,7 +319,16 @@ function TimedOutLogEntry() {
             i18nKey="project_timed_out_fatal_error"
             components={[
               // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-              <a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F#Fatal_compile_errors_blocking_the_compilation" />,
+              <a
+                href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F#Fatal_compile_errors_blocking_the_compilation"
+                onClick={() => {
+                  sendMB('paywall-info-click', {
+                    'paywall-type': 'compile-timeout',
+                    content: 'docs',
+                    type: 'fatal-error',
+                  })
+                }}
+              />,
             ]}
           />
           {!lastCompileOptions.stopOnFirstError && (
@@ -335,7 +354,16 @@ function TimedOutLogEntry() {
           i18nKey="project_timed_out_learn_more"
           components={[
             // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-            <a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F" />,
+            <a
+              href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F"
+              onClick={() => {
+                sendMB('paywall-info-click', {
+                  'paywall-type': 'compile-timeout',
+                  content: 'docs',
+                  type: 'learn-more',
+                })
+              }}
+            />,
           ]}
         />
       </p>

+ 21 - 0
services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt-new.tsx

@@ -179,6 +179,13 @@ const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({
                     href="/learn/how-to/Optimising_very_large_image_files"
                     rel="noopener noreferrer"
                     target="_blank"
+                    onClick={() => {
+                      eventTracking.sendMB('paywall-info-click', {
+                        'paywall-type': 'compile-timeout',
+                        content: 'docs',
+                        type: 'optimize',
+                      })
+                    }}
                   />,
                 ]}
               />
@@ -192,6 +199,13 @@ const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({
                     href="/learn/how-to/Fixing_and_preventing_compile_timeouts#Step_3:_Assess_your_project_for_time-consuming_tasks_and_fatal_errors"
                     rel="noopener noreferrer"
                     target="_blank"
+                    onClick={() => {
+                      eventTracking.sendMB('paywall-info-click', {
+                        'paywall-type': 'compile-timeout',
+                        content: 'docs',
+                        type: 'fatal-error',
+                      })
+                    }}
                   />,
                 ]}
               />
@@ -225,6 +239,13 @@ const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({
                   href="/learn/how-to/Fixing_and_preventing_compile_timeouts"
                   rel="noopener noreferrer"
                   target="_blank"
+                  onClick={() => {
+                    eventTracking.sendMB('paywall-info-click', {
+                      'paywall-type': 'compile-timeout',
+                      content: 'docs',
+                      type: 'learn-more',
+                    })
+                  }}
                 />,
               ]}
             />