Skip to content

Commit

Permalink
Add analytics events for Leap liquidity modal
Browse files Browse the repository at this point in the history
  • Loading branch information
baktun14 committed Dec 7, 2023
1 parent ab6a223 commit 2e6fa47
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 16 additions & 2 deletions deploy-web/src/components/liquidity-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type { StdSignDoc } from "@cosmjs/amino";
import type { SignDoc } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { useWallet } from "@src/context/WalletProvider";
import Button from "@mui/material/Button";
import { event } from "nextjs-google-analytics";
import { AnalyticsEvents } from "@src/utils/analytics";

const theme: ThemeDefinition = {
colors: {
Expand Down Expand Up @@ -87,8 +89,16 @@ const tabsConfig: TabsConfig = {
};

const ToggleLiquidityModalButton: React.FC<{ onClick: () => void }> = ({ onClick }) => {
const _onClick = () => {
event(AnalyticsEvents.LEAP_GET_MORE_TOKENS, {
category: "wallet",
label: "Open Leap liquidity modal"
});

onClick();
};
return (
<Button variant="contained" color="secondary" onClick={onClick}>
<Button variant="contained" color="secondary" onClick={_onClick}>
Get More
</Button>
);
Expand Down Expand Up @@ -160,6 +170,11 @@ export const LiquidityModal: React.FC<{ address: string; aktBalance: number; ref
if (denom === "uakt") {
refreshBalances();
}

event(AnalyticsEvents.LEAP_TRANSACTION_COMPLETE, {
category: "wallet",
label: "Completed a transaction on Leap liquidity modal"
});
}
}
}, []);
Expand Down Expand Up @@ -193,4 +208,3 @@ export const LiquidityModal: React.FC<{ address: string; aktBalance: number; ref
</>
);
};

2 changes: 2 additions & 0 deletions deploy-web/src/utils/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export enum AnalyticsEvents {
CREATE_GPU_DEPLOYMENT = "create_gpu_deployment",
AUTHORIZE_SPEND = "authorize_spend",
NAVIGATE_TAB = "navigate_tab_", // Append tab
LEAP_GET_MORE_TOKENS = "leap_get_more_tokens",
LEAP_TRANSACTION_COMPLETE = "leap_transaction_complete",

// SDL Builder
DEPLOY_SDL = "deploy_sdl",
Expand Down

0 comments on commit 2e6fa47

Please sign in to comment.