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