Skip to content

Showcase: fix the traffic chart (bot filter) and show total engaged hours - #304

Merged
ASCoding11 merged 1 commit into
mainfrom
showcase-traffic-fix
Nov 25, 2026
Merged

ASCoding11 merged 1 commit into
mainfrom
showcase-traffic-fix

Conversation

@ASCoding11

Copy link
Copy Markdown
Owner
  • Showcase traffic chart (/showcase/): a bot loaded the showcase page ~11,000 times on Nov 20–22 (about 0.4 engaged hours between all of them, ~94% "mobile"). /api/traffic only filtered 0-second homepage bot sessions, so these counted as visitors: the daily chart peaked at 6,803 and every normal ~100-a-day day flattened into the floor. The tiles were inflated too (11.6k visitors, 94% on a phone) and Showcase topped "Top pages".
  • New bot rule in functions/api/traffic.js (⚠️ functions/ change): a session whose views all had 0 engaged seconds is dropped on any page if it's a first visit or has no referrer. Real visitors who stay 5+ seconds always log engaged time, so they're unaffected; a brand-new visitor who leaves in under 5 seconds is no longer counted.
  • Re-working past days: saved traffic_days summaries now carry ver: 2. Old ones are redone up to 4 per request, newest first, and _latest isn't saved until all are done. One-time cost: re-reading the last 29 days of pageviews (~28k Firestore reads, spread over a few requests), within the free 50k/day.
  • Tile change: "Avg engaged time" is replaced by "Total engaged hours" (engagedHours, already in the API and the fallback snapshot).
  • What's new: fix entry 1.51.2 with Spanish.

Generated by Claude Code

…ngaged hours

The /api/traffic bot filter only caught 0-second homepage sessions, so a bot that
loaded /showcase/ ~11,000 times on Nov 20-22 (0.4 engaged hours total) counted as
visitors and squashed the visitors-per-day chart. Sessions whose views all had 0
engaged seconds are now dropped on any page when they're a first visit or have no
referrer. Saved day summaries carry a version and are redone (4 a request, newest
first) so past days pick up the new rule. The avg engaged time tile becomes total
engaged hours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ZY4Ga2jzFB4HXTkDdJZCT
@netlify

netlify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for ascoding11 ready!

Name Link
🔨 Latest commit 4dbd251
🔍 Latest deploy log https://app.netlify.com/projects/ascoding11/deploys/6b06ec28e4898cebac79e8cc
😎 Deploy Preview https://deploy-preview-304--ascoding11.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying ascoding11-github-io with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4dbd251
Status: ✅  Deploy successful!
Preview URL: https://a774cb8a.ascoding11-github-io.pages.dev
Branch Preview URL: https://showcase-traffic-fix.ascoding11-github-io.pages.dev

View logs

@netlify

netlify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cosmic-dasik-e73c56 ready!

Name Link
🔨 Latest commit 4dbd251
🔍 Latest deploy log https://app.netlify.com/projects/cosmic-dasik-e73c56/deploys/6b06ec28564fc7591d29d6bb
😎 Deploy Preview https://deploy-preview-304--cosmic-dasik-e73c56.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ASCoding11
ASCoding11 merged commit 0940c7c into main Nov 25, 2026
11 checks passed
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.

2 participants