Skip to content

Citations: add an "Own domain only" filter (currently we can only hide it, not isolate it) #149

Closed

Description

@gkhngyk

Problem

The Citations page lets users hide their own domain from the list (Exclude own domain) and show only competitors (Competitors only), but there's no way to isolate just their own domain — to answer the very common AEO question "which of my pages are AI engines actually citing?".

Today's two filters at web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx:586-610:

Filter Behavior
Exclude own domain Hides rows where category = you
Competitors only Shows only rows where category = competitor

SOURCE_CATEGORIES in web/src/lib/citations/classify.ts already includes a you bucket — citations to the user's tracked domain — and the aggregation in web/src/lib/actions/citations.ts:241 already discriminates on that category. The data is there; the UI just has no toggle that says "give me only my own".

Proposed change

Add a third filter button Own domain only alongside the existing two. It mirrors the existing pattern:

  • New field ownOnly?: boolean on CitationsFilters in web/src/lib/actions/citations.ts.
  • In the aggregation loop, when ownOnly === true, skip rows where category !== 'you'.
  • A new toggle button in the filter bar (around line 596) with the same variant/size/className shape as the other two.
  • The three buttons are mutually exclusive: turning Own domain only on resets excludeOwnDomain and competitorOnly (they can't coexist semantically — "exclude own" while "show only own" is nonsensical). The same already happens between the existing two (line 604).

Acceptance criteria

  • New Own domain only button appears in the citations filter bar, sitting next to the existing two
  • Toggling it ON filters the list (and the source-type/domain/URL panels) to only category = you rows
  • Toggling it ON also turns OFF the other two filters when they're set, so the three behave mutually exclusively
  • The KPI tiles and the Source Types pie chart respond to the filter the same way they do for the existing toggles
  • pnpm tsc --noEmit + yarn lint clean
  • No regression on the existing two toggles

Out of scope

  • Refactoring the three buttons into a single segmented control (cleaner UX but a bigger change — leave for a follow-up if anyone wants to pick it up)
  • Adding the same filter to the MCP list_citations tool input schema (currently only the page exposes these toggles; adding them at the data layer is a separate enhancement)
  • Translation copy beyond English — Citations page already only uses English strings inline; matching the convention is fine.

Notes

The existing two toggles are a good template — the implementation should look almost identical, just with a new button and one extra check in the aggregator. Pair with the in-file roleLabel pattern for any user-facing copy you add.

Activity

  1. added
    enhancement
    good first issue
    help wanted
    on Jun 2, 2026
  2. Pallavikumarimdb commented on Jun 2, 2026

    @Pallavikumarimdb
    Contributor

    @gkhngyk Can I work on this?

  3. gkhngyk commented on Jun 2, 2026

    @gkhngyk
    ContributorAuthor

    All yours @Pallavikumarimdb, assigning to you. Thanks for picking up another one.

    The existing two toggles in the same component are exactly the template — copy the Exclude own domain / Competitors only button shape at web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx:586-610 and add a third for "Own domain only". The matching filter check goes in the aggregation loop at web/src/lib/actions/citations.ts:241 right next to the existing category === 'you' check. Three buttons should be mutually exclusive — flip the other two off when "Own only" turns on.

    No rush — whenever you wrap #148 (just the yarn format push), pick this up next. PR with Closes #149.

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

Metadata

Metadata

Labels

enhancementgood first issuehelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions