Skip to content

Commit

Permalink
feat: track click by download buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
vitonsky committed Jun 24, 2024
1 parent 18e259b commit 673879c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions site/src/components/Landing/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import React from 'react';
import { clsx } from 'clsx';
import { Button, HStack, Icon, Image, Link, Text, VStack } from '@chakra-ui/react';

import { useAnalyticsContext } from '../Analytics/useAnalyticsContext';
import Logo from './logo.svg';

import styles from './Landing.module.css';

export const Landing = ({ baseUrl }: { baseUrl: string }) => {
const getUrl = (path: string) => [baseUrl, path].join('/').replace(/\/{2,}/g, '/');

const { trackEvent } = useAnalyticsContext();

return (
<VStack w="100%" spacing={0}>
<VStack w="100%" className={clsx(styles.TopScreen)}>
Expand Down Expand Up @@ -68,6 +71,11 @@ export const Landing = ({ baseUrl }: { baseUrl: string }) => {
target="_blank"
href="https://chrome.google.com/webstore/detail/gbefmodhlophhakmoecijeppjblibmie"
px={4}
onClick={() => {
trackEvent('Download link: Click', {
target: 'chrome',
});
}}
>
Install for Chrome
</Button>
Expand All @@ -84,6 +92,11 @@ export const Landing = ({ baseUrl }: { baseUrl: string }) => {
target="_blank"
href="https://addons.mozilla.org/addon/linguist-translator/"
px={4}
onClick={() => {
trackEvent('Download link: Click', {
target: 'firefox',
});
}}
>
Install for Firefox
</Button>
Expand Down

0 comments on commit 673879c

Please sign in to comment.