Skip to content

Commit 9f76ed5

Browse files
chore: see weekly users
1 parent 93b3482 commit 9f76ed5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pages/api/active-users.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ async function fetchActiveUsersFromPostHog(): Promise<number | null> {
7979
const url = `${posthogUrl}/api/projects/${projectId}/query/`
8080

8181
const now = new Date()
82-
const twentyFourHoursAgo = new Date(
83-
now.getTime() - 24 * 60 * 60 * 1000,
82+
const sevenDaysAgo = new Date(
83+
now.getTime() - 7 * 24 * 60 * 60 * 1000, // 7 days ago
8484
).toISOString()
8585

8686
try {
@@ -97,7 +97,7 @@ async function fetchActiveUsersFromPostHog(): Promise<number | null> {
9797
SELECT count(DISTINCT person_id) as recent_users
9898
FROM events
9999
WHERE event = '$pageview'
100-
AND timestamp > toDateTime('${twentyFourHoursAgo}')
100+
AND timestamp > toDateTime('${sevenDaysAgo}')
101101
`,
102102
},
103103
}),

0 commit comments

Comments
 (0)