Skip to content

Commit

Permalink
Merge pull request #149 from arconnectio/feat/track-sign
Browse files Browse the repository at this point in the history
feat: adds anonymous tracking on sign
  • Loading branch information
nicholaswma authored Nov 13, 2023
2 parents 57891d8 + 90cac33 commit 835109b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/api/modules/sign/sign.background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import Application from "~applications/application";
import browser from "webextension-polyfill";
import Arweave from "arweave";
import { EventType, trackDirect } from "~utils/analytics";

const background: ModuleFunction<BackgroundResult> = async (
appData,
Expand Down Expand Up @@ -152,6 +153,11 @@ const background: ModuleFunction<BackgroundResult> = async (
if (keyfile) {
freeDecryptedWallet(keyfile);
}
// analytics
await trackDirect(EventType.SIGNED, {
appUrl: appData.appURL,
totalInAR: arweave.ar.winstonToAr(price.toString())
});

// return de-constructed transaction
return {
Expand Down
3 changes: 2 additions & 1 deletion src/utils/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export enum EventType {
ONBOARDED = "ONBOARDED",
WAYFINDER_ACTIVATED = "WAYFINDER_ACTIVATED",
WAYFINDER_GATEWAY_SELECTED = "WAYFINDER_GATEWAY_SELECTED",
BALANCE = "BALANCE"
BALANCE = "BALANCE",
SIGNED = "SIGNED"
}

export enum PageType {
Expand Down

0 comments on commit 835109b

Please sign in to comment.