added events on homepage contentblocks

This commit is contained in:
ronronscelestes 2022-05-13 16:23:05 +02:00
parent 970384af4b
commit 2c79e4ad05

View File

@ -1,12 +1,12 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
import { ContentBox, useTracking } from '@strapi/helper-plugin';
import { Stack } from '@strapi/design-system/Stack'; import { Stack } from '@strapi/design-system/Stack';
import InformationSquare from '@strapi/icons/InformationSquare'; import InformationSquare from '@strapi/icons/InformationSquare';
import CodeSquare from '@strapi/icons/CodeSquare'; import CodeSquare from '@strapi/icons/CodeSquare';
import PlaySquare from '@strapi/icons/PlaySquare'; import PlaySquare from '@strapi/icons/PlaySquare';
import FeatherSquare from '@strapi/icons/FeatherSquare'; import FeatherSquare from '@strapi/icons/FeatherSquare';
import { ContentBox } from '@strapi/helper-plugin';
const BlockLink = styled.a` const BlockLink = styled.a`
text-decoration: none; text-decoration: none;
@ -14,6 +14,11 @@ const BlockLink = styled.a`
const ContentBlocks = () => { const ContentBlocks = () => {
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
const { trackUsage } = useTracking();
const handleClick = eventName => {
trackUsage(eventName);
};
return ( return (
<Stack spacing={5}> <Stack spacing={5}>
@ -21,6 +26,7 @@ const ContentBlocks = () => {
href="https://strapi.io/resource-center" href="https://strapi.io/resource-center"
target="_blank" target="_blank"
rel="noopener noreferrer nofollow" rel="noopener noreferrer nofollow"
onClick={() => handleClick('didClickonReadTheDocumentationSection')}
> >
<ContentBox <ContentBox
title={formatMessage({ title={formatMessage({
@ -39,6 +45,7 @@ const ContentBlocks = () => {
href="https://strapi.io/starters" href="https://strapi.io/starters"
target="_blank" target="_blank"
rel="noopener noreferrer nofollow" rel="noopener noreferrer nofollow"
onClick={() => handleClick('didClickonCodeExampleSection')}
> >
<ContentBox <ContentBox
title={formatMessage({ title={formatMessage({
@ -57,6 +64,7 @@ const ContentBlocks = () => {
href="https://strapi.io/blog/categories/tutorials" href="https://strapi.io/blog/categories/tutorials"
target="_blank" target="_blank"
rel="noopener noreferrer nofollow" rel="noopener noreferrer nofollow"
onClick={() => handleClick('didClickonTutorialSection')}
> >
<ContentBox <ContentBox
title={formatMessage({ title={formatMessage({
@ -71,7 +79,12 @@ const ContentBlocks = () => {
iconBackground="secondary100" iconBackground="secondary100"
/> />
</BlockLink> </BlockLink>
<BlockLink href="https://strapi.io/blog" target="_blank" rel="noopener noreferrer nofollow"> <BlockLink
href="https://strapi.io/blog"
target="_blank"
rel="noopener noreferrer nofollow"
onClick={() => handleClick('didClickonBlogSection')}
>
<ContentBox <ContentBox
title={formatMessage({ title={formatMessage({
id: 'app.components.BlockLink.blog', id: 'app.components.BlockLink.blog',