@@ -189,6 +189,7 @@ export function reportFaucetUsed(properties: {
189189 chainId : properties . chainId ,
190190 } ) ;
191191}
192+
192193// ----------------------------
193194// CHAIN CONFIGURATION
194195// ----------------------------
@@ -222,140 +223,161 @@ export function reportChainConfigurationAdded(properties: {
222223// ASSETS
223224// ----------------------------
224225
225- type StatusWithError =
226- | {
227- status : "successful" | "attempted" ;
228- }
229- | {
230- status : "failed" ;
231- error : string ;
232- } ;
233-
234226type AssetContractType = "DropERC20" | "DropERC1155" | "DropERC721" ;
235227
236228/**
237229 * ### Why do we need to report this event?
238- * - To track asset buy statuses (successful, failed, attempted) in the new asset pages
230+ * - To track number of successful asset buys from the asset page
231+ * - To track which asset and contract types are being bought the most
239232 *
240233 * ### Who is responsible for this event?
241234 * @MananTank
242- *
243235 */
244- export function reportAssetBuy (
245- properties : {
246- chainId : number ;
247- assetType : "NFT" | "Coin" ;
248- contractType : AssetContractType ;
249- } & StatusWithError ,
250- ) {
251- // Example: asset buy NFT successful
252- posthog . capture ( `asset buy ${ properties . assetType } ${ properties . status } ` , {
236+ export function reportAssetBuySuccessful ( properties : {
237+ chainId : number ;
238+ contractType : AssetContractType ;
239+ assetType : "nft" | "coin" ;
240+ } ) {
241+ posthog . capture ( "asset buy successful" , {
253242 chainId : properties . chainId ,
254243 contractType : properties . contractType ,
255- ...( properties . status === "failed" && {
256- error : properties . error ,
257- } ) ,
244+ assetType : properties . assetType ,
258245 } ) ;
259246}
260247
261248/**
262249 * ### Why do we need to report this event?
263- * - To track the CTA card clicks on the assets page
250+ * - To track number of failed asset buys from the asset page
251+ * - To track the errors that users encounter when trying to buy an asset
264252 *
265253 * ### Who is responsible for this event?
266254 * @MananTank
255+ */
256+ export function reportAssetBuyFailed ( properties : {
257+ chainId : number ;
258+ contractType : AssetContractType ;
259+ assetType : "nft" | "coin" ;
260+ error : string ;
261+ } ) {
262+ posthog . capture ( "asset buy failed" , {
263+ chainId : properties . chainId ,
264+ contractType : properties . contractType ,
265+ assetType : properties . assetType ,
266+ error : properties . error ,
267+ } ) ;
268+ }
269+
270+ // Assets Landing Page ----------------------------
271+
272+ /**
273+ * ### Why do we need to report this event?
274+ * - To track number of asset creation flows started from the assets page
275+ * - To track which asset types are being created the most
267276 *
277+ * ### Who is responsible for this event?
278+ * @MananTank
268279 */
269- export function reportAssetsPageCardClick ( properties : {
270- label : "create- nft-collection " | "import-asset" | "create- coin";
280+ export function reportAssetCreationFlowStarted ( properties : {
281+ assetType : "nft" | "coin" ;
271282} ) {
272- // Example: asset page card create-nft-collection clicked
273- posthog . capture ( `assets page card ${ properties . label } clicked` ) ;
283+ posthog . capture ( "asset creation flow started" , {
284+ assetType : properties . assetType ,
285+ } ) ;
286+ }
287+
288+ /**
289+ * ### Why do we need to report this event?
290+ * - To track number of assets imported successfully from the assets page
291+ *
292+ * ### Who is responsible for this event?
293+ * @MananTank
294+ */
295+ export function reportAssetImported ( ) {
296+ posthog . capture ( "asset imported" ) ;
274297}
275298
276299/**
277300 * ### Why do we need to report this event?
278- * - To track the steps that users are going through in asset creation flow
301+ * - To track number of asset import flows started in the assets page
279302 *
280303 * ### Who is responsible for this event?
281304 * @MananTank
305+ */
306+ export function reportAssetImportFlowStarted ( ) {
307+ posthog . capture ( "asset import flow started" ) ;
308+ }
309+
310+ /**
311+ * ### Why do we need to report this event?
312+ * - To track the steps users are configuring in the asset creation flow to understand if there are any drop-offs
282313 *
314+ * ### Who is responsible for this event?
315+ * @MananTank
283316 */
284- export function reportCreateAssetStepNextClicked (
317+ export function reportAssetCreationStepConfigured (
285318 properties :
286319 | {
287- assetType : "NFT " ;
288- page : "collection-info" | "upload-assets" | "sales-settings" ;
320+ assetType : "nft " ;
321+ step : "collection-info" | "upload-assets" | "sales-settings" ;
289322 }
290323 | {
291- assetType : "Coin " ;
292- page : "coin-info" | "token-distribution" | "launch-coin" ;
324+ assetType : "coin " ;
325+ step : "coin-info" | "token-distribution" | "launch-coin" ;
293326 } ,
294327) {
295- // Example: create asset NFT collection-info next clicked
296- posthog . capture (
297- `create asset ${ properties . assetType } ${ properties . page } next clicked` ,
298- ) ;
328+ posthog . capture ( " asset creation step configured" , {
329+ assetType : properties . assetType ,
330+ step : properties . step ,
331+ } ) ;
299332}
300333
301334/**
302335 * ### Why do we need to report this event?
303- * - To track the status of each step of the create asset flow
336+ * - To track number of successful asset creations from the assets page
337+ * - To track which asset types are being created the most
304338 *
305339 * ### Who is responsible for this event?
306340 * @MananTank
341+ */
342+ export function reportAssetCreationSuccessful ( properties : {
343+ assetType : "nft" | "coin" ;
344+ contractType : AssetContractType ;
345+ } ) {
346+ posthog . capture ( "asset creation successful" , {
347+ assetType : properties . assetType ,
348+ contractType : properties . contractType ,
349+ } ) ;
350+ }
351+
352+ /**
353+ * ### Why do we need to report this event?
354+ * - To track number of failed asset creations from the assets page
355+ * - To track the errors that users encounter when trying to create an asset
356+ * - To track the step that users are failing at in the asset creation flow
307357 *
358+ * ### Who is responsible for this event?
359+ * @MananTank
308360 */
309- export function reportCreateAssetStepStatus (
310- properties : (
361+ export function reportAssetCreationFailed (
362+ properties : { contractType : AssetContractType ; error : string } & (
311363 | {
312- assetType : "NFT " ;
313- step : "deploy-contract" | "lazy- mint-nfts" | "set-claim-conditions" ;
364+ assetType : "nft " ;
365+ step : "deploy-contract" | "mint-nfts" | "set-claim-conditions" ;
314366 }
315367 | {
316- assetType : "Coin " ;
368+ assetType : "coin " ;
317369 step :
318370 | "deploy-contract"
319371 | "set-claim-conditions"
320372 | "mint-tokens"
321373 | "airdrop-tokens" ;
322374 }
323- ) &
324- StatusWithError & {
325- contractType : AssetContractType ;
326- } ,
327- ) {
328- // Example: create asset NFT deploy-contract successful
329- posthog . capture (
330- `create asset ${ properties . assetType } ${ properties . step } ${ properties . status } ` ,
331- {
332- ...( properties . status === "failed" && {
333- error : properties . error ,
334- } ) ,
335- contractType : properties . contractType ,
336- } ,
337- ) ;
338- }
339-
340- /**
341- * ### Why do we need to report this event?
342- * - To track the status of create asset as a whole (successful, failed, attempted)
343- *
344- * ### Who is responsible for this event?
345- * @MananTank
346- *
347- */
348- export function reportCreateAssetStatus (
349- properties : {
350- assetType : "NFT" | "Coin" ;
351- contractType : AssetContractType ;
352- } & StatusWithError ,
375+ ) ,
353376) {
354- // Example: create asset NFT successful
355- posthog . capture ( `create asset ${ properties . assetType } ${ properties . status } ` , {
356- ...( properties . status === "failed" && {
357- error : properties . error ,
358- } ) ,
377+ posthog . capture ( "asset creation failed" , {
378+ assetType : properties . assetType ,
359379 contractType : properties . contractType ,
380+ error : properties . error ,
381+ step : properties . step ,
360382 } ) ;
361383}
0 commit comments