Skip to content

fix(traffic): keep the export going without the untracked queries, and match the AI bots sheets to the report - #1244

Merged
gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:fix/traffic-export-followups
Oct 20, 2026
Merged

gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:fix/traffic-export-followups

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Two follow-ups from the AI Traffic reviews, both about the page's export.

#1178: keep the export going without the untracked queries.

  • The export read getUntrackedGoogleQueries without a .catch, so an API 5xx failed the whole file.
  • It now gets .catch(() => null), as getTrafficBots and getTrafficSources have. The Untracked Google queries sheet then says why it's empty, and every other sheet still exports.

#1182: match the AI bots sheets to the report.

  • AI bots had one row per bot, while the By bot type card has one row per type. It now has one row per type, as the card shows it: type, its bots, hits, pages read and last seen.
  • New sheet Cited pages no search bot read for the report's uncrawled list:
    • It lists the pages as the report does: the most cited first, then a row with how many more there are.
    • It gives a note while the bot data is under 30 days or not whole, and another when every cited page was read.
  • The sheet goes in the whole-page export (Excel and the CSV zip).

Left out:

Related issue

Follow-ups from the reviews on #1178 and #1182.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. On a brand with AI-bot data, open AI Traffic and export Excel.
    • AI bots has one row per bot type, with its bots listed (e.g. "Training — GPTBot, ClaudeBot").
    • Cited pages no search bot read lists the report's pages, or a note while the data is under 30 days.
  2. With the untracked-queries API failing, the export still downloads. The Untracked Google queries sheet carries a note.

Locally, a CSV of section=bots read Training,"ClaudeBot, GPTBot",52,2,… from four test rows. section=uncrawledPages gave the "30 days of whole data" note.

Tests:

  • traffic-export.test.ts: the per-type sheet, the uncrawled list with "N more", and the notes.
  • route.test.ts: the new sheet in the workbook and the zip; the export survives an untracked-queries failure.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

yarn test (1785 before merging main) and yarn build also pass.

🤖 Generated with Claude Code

cihan-gyk and others added 2 commits October 20, 2026 10:35
…d match the AI bots sheets to the report

Follow-ups from gkhngyk's AI Traffic reviews:

- ansvisor#1178: the export read the untracked Google queries without a .catch,
  so an API 5xx failed the whole file. It now leaves that sheet with its
  note and exports the rest, as the AI bot report already does.
- ansvisor#1182: the AI bots sheet had one row per bot while the By bot type card
  has one row per type; it now has one per type, with its bots. The cited
  pages no search bot read in 30 days get their own sheet, as the report
  lists them (the most cited, then how many more), with a note while the
  bot data is under 30 days or not whole.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk Two of your export notes from the AI Traffic reviews: the export now survives an untracked-queries failure (#1178), and the AI bots sheet has one row per type like the By bot type card, plus a new "Cited pages no search bot read" sheet (#1182). The full uncrawled list needs ai_bot_report's limit 10 changed, which #1225 also redefines, so it waits for #1225. The "one untracked fetch per page" note is handled in #1216's review fixes.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. The export now matches the report: the AI bots sheet reads like the By bot type card, and the cited pages no search bot read get a sheet of their own.

  1. A failed read now says something untrue. When the untracked-queries read fails:

    • googleQueries gets null;
    • the sheet then says "No query data from Google Search Console yet", even though the brand has Search Console connected.

    The AI-bot sheets already do the same when getTrafficBots fails ("No AI-bot requests in this range"), and with this PR so does the new uncrawled sheet. Please keep a failed section apart from an empty one. For example, catch to a failed marker and write a note like "Couldn't read this section; export again to include it". Then assert the note text in the route test, not just "Note".

Smaller:

  • With alertState: 'stale' the new sheet says "Listed once the AI bots have sent 30 days of whole data". The data is paused there, not short, so the report's alertStale wording fits better.

…it's empty

When the untracked-queries read or the AI bot report failed, the export
left it out so the rest still exported, but its sheets then said "No
query data from Google Search Console yet" or "No AI-bot requests in
this range", which wasn't true. The route now notes those sections as
unread, and their sheets say "Couldn't read this section; export again
to include it". The uncrawled-pages sheet also tells a paused alert
(stale) from one still waiting for 30 days of data, as the report does.

Review on ansvisor#1244.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk thanks, fixed in the latest commit:

  • A failed read: the route catches the untracked-queries and AI-bot reads with leftOut(section), which logs the error and records the section in data.unread. Their sheets (Untracked Google queries, AI bots, Pages AI bots read, Cited pages no search bot read) then say "Couldn't read this section; export again to include it" instead of an empty-data note. The route tests now assert that text in the zip's CSVs for both failures, and a unit test checks that only the failed section says it.
  • Stale: the uncrawled sheet says "Paused: the bot data doesn't cover the last 30 days, or the month's cap was reached, so the pages search bots read aren't complete", the report's alertStale sense. waiting keeps "Listed once the AI bots have sent 30 days of data".

Web format, lint, typecheck, 1795 tests and build pass.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, both points are fixed. A failed read now says "Couldn't read this section; export again to include it" on its sheets, for the untracked queries and for all three AI bot sheets. A paused alert reads as paused, not as waiting. Tested with #1247 on main: web 1,893 and server 1,919 tests pass, and tsc, lint and Prettier are clean.

@gkhngyk
gkhngyk merged commit ce07273 into ansvisor:main Oct 20, 2026
5 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