Track key events

This commit is contained in:
Ben Grant 2021-04-12 13:27:23 +10:00
parent 1b40a5919b
commit 003f4e811a
3 changed files with 11 additions and 2 deletions

View file

@ -2,7 +2,7 @@ import { Button } from 'components';
const Donate = () => (
<div style={{ marginTop: 6, marginLeft: 12 }}>
<a href="https://www.paypal.com/donate?business=N89X6YXRT5HKW&item_name=Crab+Fit+Donation&currency_code=AUD" target="_blank" rel="noreferrer">
<a onClick={() => gtag('event', 'donate', { 'event_category': 'donate' })} href="https://www.paypal.com/donate?business=N89X6YXRT5HKW&item_name=Crab+Fit+Donation&currency_code=AUD" target="_blank" rel="noreferrer">
<Button
buttonHeight="30px"
buttonWidth="90px"

View file

@ -257,6 +257,9 @@ const Event = (props) => {
}
} finally {
setIsLoginLoading(false);
gtag('event', 'login', {
'event_category': 'event',
});
}
};
@ -279,6 +282,9 @@ const Event = (props) => {
.then(() => {
setCopied('Copied!');
setTimeout(() => setCopied(null), 1000);
gtag('event', 'copy_link', {
'event_category': 'event',
});
})
.catch((e) => console.error('Failed to copy', e))
}
@ -286,7 +292,7 @@ const Event = (props) => {
>{copied ?? `https://crab.fit/${id}`}</ShareInfo>
<ShareInfo isLoading={isLoading}>
{!!event?.name &&
<>Copy the link to this page, or share via <a href={`mailto:?subject=${encodeURIComponent(`Scheduling ${event?.name}`)}&body=${encodeURIComponent(`Visit this link to enter your availabilities: https://crab.fit/${id}`)}`}>email</a>.</>
<>Copy the link to this page, or share via <a onClick={() => gtag('event', 'send_email', { 'event_category': 'event' })} href={`mailto:?subject=${encodeURIComponent(`Scheduling ${event?.name}`)}&body=${encodeURIComponent(`Visit this link to enter your availabilities: https://crab.fit/${id}`)}`}>email</a>.</>
}
</ShareInfo>
</>

View file

@ -131,6 +131,9 @@ const Home = () => {
},
});
push(`/${response.data.id}`);
gtag('event', 'create_event', {
'event_category': 'home',
});
} catch (e) {
setError('An error ocurred while creating the event. Please try again later.');
console.error(e);