현재 접속자 열린 페이지 목록 표시
This commit is contained in:
@@ -1446,6 +1446,16 @@ export const getAnalyticsActiveSessions = async (options = {}) => {
|
||||
: `ip:${row.ip_address || row.session_hash}`
|
||||
const existingVisitor = activeVisitors.get(activeKey)
|
||||
const durationSeconds = Number(row.duration_seconds || 0)
|
||||
const page = {
|
||||
key: row.path || row.session_hash,
|
||||
path: row.path,
|
||||
postSlug: row.post_slug || '',
|
||||
pageSlug: row.page_slug || '',
|
||||
postTitle: row.post_title || '',
|
||||
pageTitle: row.page_title || '',
|
||||
durationSeconds,
|
||||
lastSeenAt: row.last_seen_at ? new Date(row.last_seen_at).toISOString() : null
|
||||
}
|
||||
|
||||
if (existingVisitor) {
|
||||
existingVisitor.pageCount += 1
|
||||
@@ -1454,6 +1464,9 @@ export const getAnalyticsActiveSessions = async (options = {}) => {
|
||||
existingVisitor.maxScrollRatio,
|
||||
Number(row.max_scroll_ratio || 0)
|
||||
)
|
||||
if (!existingVisitor.pages.some((item) => item.key === page.key)) {
|
||||
existingVisitor.pages.push(page)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -1466,6 +1479,7 @@ export const getAnalyticsActiveSessions = async (options = {}) => {
|
||||
postTitle: row.post_title || '',
|
||||
pageTitle: row.page_title || '',
|
||||
pageCount: 1,
|
||||
pages: [page],
|
||||
durationSeconds,
|
||||
maxScrollRatio: Number(row.max_scroll_ratio || 0),
|
||||
lastSeenAt: row.last_seen_at ? new Date(row.last_seen_at).toISOString() : null,
|
||||
|
||||
Reference in New Issue
Block a user