Skip to content

feat: add bot traffic filtering and engaged sessions metric to static analytics#4838

Open
MillenniumFalconMechanic wants to merge 2 commits into
mainfrom
mim/4837-bot-filtering
Open

feat: add bot traffic filtering and engaged sessions metric to static analytics#4838
MillenniumFalconMechanic wants to merge 2 commits into
mainfrom
mim/4837-bot-filtering

Conversation

@MillenniumFalconMechanic
Copy link
Copy Markdown
Contributor

Ticket

Closes #4837

Summary

  • Add regex-based suspicious page path filter to remove bot/malformed paths from the pageviews detail table (broken markdown links, CMS probes, asset requests, etc.)
  • Add engagedSessions GA4 metric alongside sessions — displayed as "Engaged Sessions" in the stats card instead of "User Sessions"
  • Export engaged_sessions in meta.json

Note

These changes affect all sites using the shared analytics package (AnVIL Portal, LungMAP, HCA Explorer, etc.)

Test plan

  • Verify the generator runs successfully with the new metric
  • Verify suspicious page paths are filtered from the pageviews table
  • Verify the stats card shows "Engaged Sessions" with the correct count

🤖 Generated with Claude Code

… analytics #4837

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the shared static analytics generator to reduce bot noise in pageview reports and surface GA4 engaged sessions as a primary stat.

Changes:

  • Adds a suspicious page-path regex filter for pageviews.
  • Fetches and exports GA4 engagedSessions.
  • Updates the dashboard stats card from “User Sessions” to “Engaged Sessions.”

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
analytics/analytics_package/analytics/static_site/fetch.py Adds suspicious path filtering and fetches engaged sessions.
analytics/analytics_package/analytics/static_site/export.py Includes engaged sessions in meta.json.
analytics/analytics_package/analytics/static_site/template/index.html Displays engaged sessions in the stats grid.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread analytics/analytics_package/analytics/static_site/template/index.html Outdated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread analytics/analytics_package/analytics/static_site/fetch.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add bot traffic filtering and engaged sessions metric to static analytics

2 participants