Skip to content

Commit

Permalink
[wallet-ext] hide asset tracking (MystenLabs#13020)
Browse files Browse the repository at this point in the history
## Description 

tracking events

## Test Plan 

Locally

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
Nikhil-Mysten authored Jul 17, 2023
1 parent 1df4cab commit faa422a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
36 changes: 36 additions & 0 deletions apps/wallet/src/shared/analytics/ampli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ export interface ClickedCollectibleCardProperties {
objectId: string;
}

export interface ClickedHideAssetProperties {
/**
* The object type of a collectible.
*/
collectibleType: string;
/**
* The ID of an object on Sui.
*/
objectId: string;
}

export interface ClickedStakeSuiProperties {
/**
* Whether or not the user is already staking some SUI.
Expand Down Expand Up @@ -389,6 +400,14 @@ export class ClickedGetStarted implements BaseEvent {
event_type = 'clicked get started';
}

export class ClickedHideAsset implements BaseEvent {
event_type = 'clicked hide asset';

constructor(public event_properties: ClickedHideAssetProperties) {
this.event_properties = event_properties;
}
}

export class ClickedImportExistingWallet implements BaseEvent {
event_type = 'clicked import existing wallet';
}
Expand Down Expand Up @@ -760,6 +779,23 @@ export class Ampli {
return this.track(new ClickedGetStarted(), options);
}

/**
* clicked hide asset
*
* [View in Tracking Plan](https://data.amplitude.com/mystenlabs/Sui%20Wallet/events/main/latest/clicked%20hide%20asset)
*
* Event has no description in tracking plan.
*
* @param properties The event's properties (e.g. collectibleType)
* @param options Amplitude event options.
*/
clickedHideAsset(
properties: ClickedHideAssetProperties,
options?: EventOptions,
) {
return this.track(new ClickedHideAsset(properties), options);
}

/**
* clicked import existing wallet
*
Expand Down
5 changes: 4 additions & 1 deletion apps/wallet/src/ui/app/pages/home/nfts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ function NftsPage() {
<Button
variant="hidden"
size="icon"
onClick={(event: any) => hideAsset(objectId, event)}
onClick={(event: any) => {
ampli.clickedHideAsset({ objectId, collectibleType: type! });
hideAsset(objectId, event);
}}
after={<EyeClose16 />}
/>
</div>
Expand Down

0 comments on commit faa422a

Please sign in to comment.