@@ -4,13 +4,17 @@ import { getLocalOption } from "./localstorage";
44// Track when a user clicks on an archived page to view it
55export async function onPageClicked ( pageUrl : string ) : Promise < void > {
66 console . log ( "onPageClicked called with URL:" , pageUrl ) ;
7- await trackEvent ( "Archive" , "ViewPage" , pageUrl ) ;
7+ await trackEvent ( "Packrat Chrome Extension: Archive" , "ViewPage" , pageUrl ) ;
88}
99
1010// Track when a torrent is created for sharing
1111export async function onTorrentCreated ( numPages : number ) : Promise < void > {
1212 console . log ( "onTorrentCreated called with pages:" , numPages ) ;
13- await trackEvent ( "Sharing" , "TorrentCreated" , `${ numPages } pages` ) ;
13+ await trackEvent (
14+ "Packrat Chrome Extension: Sharing" ,
15+ "TorrentCreated" ,
16+ `${ numPages } pages` ,
17+ ) ;
1418}
1519
1620// Track when a page is successfully archived
@@ -19,11 +23,19 @@ export async function onPageArchived(
1923 pageSize ?: number ,
2024) : Promise < void > {
2125 console . log ( "onPageArchived called:" , pageUrl , pageSize ) ;
22- await trackEvent ( "Archive" , "PageArchived" , pageUrl ) ;
26+ await trackEvent (
27+ "Packrat Chrome Extension: Archive" ,
28+ "PageArchived" ,
29+ pageUrl ,
30+ ) ;
2331
2432 // If page size is provided, track it separately
2533 if ( pageSize !== undefined ) {
26- await trackEvent ( "Archive" , "PageSize" , `${ Math . round ( pageSize / 1024 ) } KB` ) ;
34+ await trackEvent (
35+ "Packrat Chrome Extension: Archive" ,
36+ "PageSize" ,
37+ `${ Math . round ( pageSize / 1024 ) } KB` ,
38+ ) ;
2739 }
2840}
2941
@@ -33,26 +45,34 @@ export async function onSettingsChanged(
3345 value : string | boolean | number ,
3446) : Promise < void > {
3547 console . log ( "onSettingsChanged:" , settingName , value ) ;
36- await trackEvent ( "Settings" , settingName , String ( value ) ) ;
48+ await trackEvent (
49+ "Packrat Chrome Extension: Settings" ,
50+ settingName ,
51+ String ( value ) ,
52+ ) ;
3753}
3854
3955// Track total archive size
4056export async function trackArchiveSize ( totalSizeBytes : number ) : Promise < void > {
4157 const sizeMB = Math . round ( totalSizeBytes / ( 1024 * 1024 ) ) ;
4258 console . log ( "trackArchiveSize:" , sizeMB , "MB" ) ;
43- await trackEvent ( "Archive" , "TotalSize" , `${ sizeMB } MB` ) ;
59+ await trackEvent (
60+ "Packrat Chrome Extension: Archive" ,
61+ "TotalSize" ,
62+ `${ sizeMB } MB` ,
63+ ) ;
4464}
4565
4666// Track when archiving starts
4767export async function onArchivingStarted ( pageUrl : string ) : Promise < void > {
4868 console . log ( "onArchivingStarted:" , pageUrl ) ;
49- await trackEvent ( "Archive" , "Started" , pageUrl ) ;
69+ await trackEvent ( "Packrat Chrome Extension: Archive" , "Started" , pageUrl ) ;
5070}
5171
5272// Track when archiving stops
5373export async function onArchivingStopped (
5474 reason : string = "manual" ,
5575) : Promise < void > {
5676 console . log ( "onArchivingStopped:" , reason ) ;
57- await trackEvent ( "Archive" , "Stopped" , reason ) ;
77+ await trackEvent ( "Packrat Chrome Extension: Archive" , "Stopped" , reason ) ;
5878}
0 commit comments