Skip to content

Commit b3fab44

Browse files
feat: prod environment for analytics
1 parent 4405c21 commit b3fab44

2 files changed

Lines changed: 30 additions & 10 deletions

File tree

src/events.ts

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ import { getLocalOption } from "./localstorage";
44
// Track when a user clicks on an archived page to view it
55
export 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
1111
export 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
4056
export 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
4767
export 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
5373
export 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
}

src/matomo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import { getLocalOption, setLocalOption } from "./localstorage";
44

5-
const MATOMO_URL = "https://argo-chrome-test.matomo.cloud/matomo.php";
6-
const SITE_ID = "2";
5+
const MATOMO_URL = "https://analytics.vaporware.network/matomo.php";
6+
const SITE_ID = "1";
77
const USER_ID_KEY = "matomoUserId";
88

99
/**

0 commit comments

Comments
 (0)