Skip to content

Commit

Permalink
feat: ✨ add new analytics api
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideSegullo committed Jun 26, 2024
1 parent 1fbe5cc commit 751b729
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/constants/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const AnalyticsEvents = unionize(
indexerBlockHeight?: number;
trailingBlocks?: number;
}>(),

// Export CSV
ExportCsvClick: ofType<{}>(),
ExportDownloadClick: ofType<{
Expand Down
18 changes: 10 additions & 8 deletions src/views/ExportHistoryDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useMutation } from '@tanstack/react-query';
import { useSelector } from 'react-redux';
import styled from 'styled-components';

import { AnalyticsEvent } from '@/constants/analytics';
import { AnalyticsEvents } from '@/constants/analytics';
import { ButtonAction, ButtonSize } from '@/constants/buttons';
import { STRING_KEYS } from '@/constants/localization';

Expand Down Expand Up @@ -232,10 +232,12 @@ export const ExportHistoryDropdown = (props: ExportHistoryDropdownProps) => {
mutateExportTransfers();
}

track(AnalyticsEvent.ExportDownloadClick, {
trades: checkedTrades,
transfers: checkedTransfers,
});
track(
AnalyticsEvents.ExportDownloadClick({
trades: checkedTrades,
transfers: checkedTransfers,
})
);
},
[checkedTrades, checkedTransfers, mutateExportTrades, mutateExportTransfers]
);
Expand All @@ -244,7 +246,7 @@ export const ExportHistoryDropdown = (props: ExportHistoryDropdownProps) => {
<DropdownMenu
onOpenChange={(open) => {
if (open) {
track(AnalyticsEvent.ExportCsvClick);
track(AnalyticsEvents.ExportCsvClick());
}
}}
items={[
Expand All @@ -256,7 +258,7 @@ export const ExportHistoryDropdown = (props: ExportHistoryDropdownProps) => {
onCheckedChange={() => {
setCheckedTrades(!checkedTrades);

track(AnalyticsEvent.ExportTradesCheckboxClick, { value: !checkedTrades });
track(AnalyticsEvents.ExportTradesCheckboxClick({ value: !checkedTrades }));
}}
/>
),
Expand All @@ -271,7 +273,7 @@ export const ExportHistoryDropdown = (props: ExportHistoryDropdownProps) => {
onCheckedChange={() => {
setCheckedTransfers(!checkedTransfers);

track(AnalyticsEvent.ExportTransfersCheckboxClick, { value: !checkedTrades });
track(AnalyticsEvents.ExportTransfersCheckboxClick({ value: !checkedTrades }));
}}
/>
),
Expand Down

0 comments on commit 751b729

Please sign in to comment.