Skip to content

Traffic: paginate the visit log and add platform filter + URL search #452

Closed

Description

@gkhngyk

Problem

The "Recent AI Referral Visits" table on the AI Traffic page is locked to the 10 most recent rows. A "N total" badge advertises how many visits exist, but there is no way to see past the first 10 — and no way to answer questions like "which of my pages get visits from Perplexity?".

The server action already supports paging: getTrafficLogs(brandId, { limit, offset }) in web/src/lib/actions/traffic.ts uses .range() and returns { logs, total }.

Fix

Server action — extend getTrafficLogs options:

  • platform?: string → .eq('source_platform', platform)
  • search?: string → .ilike('url', %${search}%) (escape %/_ in the input)
  • days?: number → .gte('created_at', ...), so the table follows the page's time-range picker once Traffic: add a 7 / 30 / 90-day time-range picker #451 lands

The returned total must respect the active filters (count over the same filtered query).

UI (web/src/app/[locale]/(dashboard)/dashboard/traffic/page.tsx):

  • Pagination under the table — reuse the TablePager pattern (Previous / X of Y / Next) from web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx.
  • A platform dropdown (options from the summary's platform breakdown + "All platforms") — a dropdown fits better than free text since there are only a handful of platforms.
  • A URL search input (debounced ~300ms) matching against the visit URL/path.
  • Changing any filter resets to page 1; the "N total" badge shows the filtered total.
  • Only the log table should re-fetch on filter changes — KPIs and charts stay as they are.

Acceptance criteria

  • All visits are reachable through pagination, 10–20 per page, newest first.
  • Platform filter and URL search work server-side (correct results beyond the first page) and combine with each other and with the time range.
  • Filter changes reset pagination and update the total badge; clearing filters restores the unfiltered view.
  • Empty filtered result shows a friendly "no matching visits" state, not a blank table.

Getting started

See CONTRIBUTING.md for setup. From web/, yarn lint, yarn typecheck and yarn format:check must pass. Comment here to claim the issue before opening a PR.

Activity

  1. added
    enhancement
    help wanted
    on Jul 16, 2026
  2. chinmaywadhe26 commented on Jul 17, 2026

    @chinmaywadhe26
    Contributor

    I'd like to take this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions