From 59cec18d7f46bfbec89c8c588c4f6799689d9066 Mon Sep 17 00:00:00 2001 From: Simon Kataev Date: Wed, 24 Jul 2024 17:16:26 +0200 Subject: [PATCH] feat: add tracking for pricing page links --- src/components/pages/pricing/hero/hero.jsx | 97 +++++++++++++--------- 1 file changed, 60 insertions(+), 37 deletions(-) diff --git a/src/components/pages/pricing/hero/hero.jsx b/src/components/pages/pricing/hero/hero.jsx index 84b0b78e3f..070fe2ad0e 100644 --- a/src/components/pages/pricing/hero/hero.jsx +++ b/src/components/pages/pricing/hero/hero.jsx @@ -13,6 +13,7 @@ import InfoIcon from 'components/shared/info-icon'; import LINKS from 'constants/links'; import CheckIcon from 'icons/check.inline.svg'; import CrossIcon from 'icons/cross.inline.svg'; +import sendGtagEvent from 'utils/send-gtag-event'; import AWSIcon from './images/aws.inline.svg'; @@ -48,7 +49,8 @@ const items = [ info: 'Additional storage: $3.5 per 2 GiB', }, { - title: '300 compute hours included', + title: + '300 compute hours included', info: 'Additional usage: $0.16 per compute hour', }, { title: 'Standard support' }, @@ -72,7 +74,8 @@ const items = [ features: [ { title: '50 GiB storage included', info: 'Additional storage: $15 per 10 GiB' }, { - title: '750 compute hours included', + title: + '750 compute hours included', info: 'Additional usage: $0.16 per compute hour', }, { title: 'Priority support' }, @@ -124,41 +127,51 @@ const scaleCardBorderVariants = { }, }; -const Feature = ({ title, info, disabled, type, index }) => ( -
  • - {disabled ? ( - - ) : ( - - )} - - {info && ( - -   - { + const handleLinkClick = (event) => { + if (trackClick && event.target.tagName === 'A') { + sendGtagEvent(event.target.id); + } + }; + + return ( + // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events +
  • + {disabled ? ( + + ) : ( + - - )} -
  • -); + )} + + {info && ( + +   + + + )} + + ); +}; Feature.propTypes = { title: PropTypes.string.isRequired, @@ -166,6 +179,7 @@ Feature.propTypes = { disabled: PropTypes.bool, type: PropTypes.string, index: PropTypes.number, + trackClick: PropTypes.bool, }; const Hero = () => { @@ -218,6 +232,9 @@ const Hero = () => { href="https://aws.amazon.com/marketplace/pp/prodview-fgeh3a7yeuzh6?sr=0-1&ref_=beagle&applicationId=AWSMPContessa" target="_blank" rel="noopener noreferrer" + onClick={() => { + sendGtagEvent('pricing_pay_via_marketplace_click'); + }} > Pay via marketplace @@ -282,7 +299,13 @@ const Hero = () => {
      {features.map((feature, index) => ( - + ))}