Просмотр исходного кода

[web] Add `unified-access-footer-click` event (#30189)

* Add event `unified-access-footer-click`

* Remove redundant `page` segmentation

Co-authored-by: @copilot
GitOrigin-RevId: 81ba64d09e29466fb73f200859805b6e17990dca
Antoine Clausse 10 месяцев назад
Родитель
Сommit
549840f3a3

+ 44 - 1
services/web/app/views/_mixins/ciam_mixins.pug

@@ -17,6 +17,14 @@ mixin ciamCardFooter(short)
 				href='https://www.digital-science.com/'
 				href='https://www.digital-science.com/'
 				target='_blank'
 				target='_blank'
 				rel='noopener noreferrer'
 				rel='noopener noreferrer'
+				event-tracking-mb='true'
+				event-tracking='unified-access-footer-click'
+				event-tracking-trigger='click'
+				event-segmentation={
+					product: 'overleaf',
+					item: 'logo',
+					destinationUrl: 'https://www.digital-science.com/',
+				}
 			)
 			)
 				img(
 				img(
 					src=buildImgPath('digital-science/digital-science.svg')
 					src=buildImgPath('digital-science/digital-science.svg')
@@ -26,7 +34,42 @@ mixin ciamCardFooter(short)
 			if short
 			if short
 				| !{translate('overleaf_is_a_ds_product')}
 				| !{translate('overleaf_is_a_ds_product')}
 			else
 			else
-				| !{translate('advancing_research_with', null, [{ name: 'a', attrs: { href: 'https://www.overleaf.com/', target: '_blank', rel: 'noopener noreferrer' }}, { name: 'a', attrs: { href: 'https://www.papersapp.com/', target: '_blank', rel: 'noopener noreferrer' }}])}
+				-
+					const linkArgs = [
+						{
+							name: 'a',
+							attrs: {
+								href: 'https://www.overleaf.com/',
+								target: '_blank',
+								rel: 'noopener noreferrer',
+								'event-tracking-mb': 'true',
+								'event-tracking': 'unified-access-footer-click',
+								'event-tracking-trigger': 'click',
+								'event-segmentation': {
+									product: 'overleaf',
+									item: 'overleaf',
+									destinationUrl: 'https://www.overleaf.com/'
+								}
+							}
+						},
+						{
+							name: 'a',
+							attrs: {
+								href: 'https://www.papersapp.com/',
+								target: '_blank',
+								rel: 'noopener noreferrer',
+								'event-tracking-mb': 'true',
+								'event-tracking': 'unified-access-footer-click',
+								'event-tracking-trigger': 'click',
+								'event-segmentation': {
+									product: 'overleaf',
+									item: 'papers',
+									destinationUrl: 'https://www.papersapp.com/'
+								}
+							}
+						}
+					]
+				| !{translate('advancing_research_with', null, linkArgs)}
 
 
 mixin ciamTermsOfServiceAgreement
 mixin ciamTermsOfServiceAgreement
 	p
 	p

+ 22 - 0
services/web/frontend/js/shared/components/layouts/ciam-layout.tsx

@@ -1,5 +1,6 @@
 import React, { FC, ReactNode } from 'react'
 import React, { FC, ReactNode } from 'react'
 import { Trans } from 'react-i18next'
 import { Trans } from 'react-i18next'
+import * as eventTracking from '@/infrastructure/event-tracking'
 import dsLogo from '@/shared/svgs/digital-science.svg'
 import dsLogo from '@/shared/svgs/digital-science.svg'
 
 
 type Props = { children: ReactNode }
 type Props = { children: ReactNode }
@@ -22,6 +23,13 @@ const CiamLayout: FC<Props> = ({ children }: Props) => (
               target="_blank"
               target="_blank"
               rel="noopener noreferrer"
               rel="noopener noreferrer"
               className="ciam-image-link"
               className="ciam-image-link"
+              onClick={() =>
+                eventTracking.sendMB('unified-access-footer-click', {
+                  product: 'overleaf',
+                  item: 'logo',
+                  destinationUrl: 'https://www.digital-science.com/',
+                })
+              }
             >
             >
               <img src={dsLogo} alt="Digital Science — home" />
               <img src={dsLogo} alt="Digital Science — home" />
             </a>
             </a>
@@ -35,12 +43,26 @@ const CiamLayout: FC<Props> = ({ children }: Props) => (
                   href="https://www.overleaf.com/"
                   href="https://www.overleaf.com/"
                   target="_blank"
                   target="_blank"
                   rel="noopener noreferrer"
                   rel="noopener noreferrer"
+                  onClick={() =>
+                    eventTracking.sendMB('unified-access-footer-click', {
+                      product: 'overleaf',
+                      item: 'overleaf',
+                      destinationUrl: 'https://www.overleaf.com/',
+                    })
+                  }
                 />,
                 />,
                 // eslint-disable-next-line jsx-a11y/anchor-has-content,react/jsx-key
                 // eslint-disable-next-line jsx-a11y/anchor-has-content,react/jsx-key
                 <a
                 <a
                   href="https://www.papersapp.com/"
                   href="https://www.papersapp.com/"
                   target="_blank"
                   target="_blank"
                   rel="noopener noreferrer"
                   rel="noopener noreferrer"
+                  onClick={() =>
+                    eventTracking.sendMB('unified-access-footer-click', {
+                      product: 'overleaf',
+                      item: 'papers',
+                      destinationUrl: 'https://www.papersapp.com/',
+                    })
+                  }
                 />,
                 />,
               ]}
               ]}
             />
             />