知识库首页 关键词资料 2026-07-14-growth-report-filter-design.md

2026 07 14 growth report filter design

本地来源:关键词/ahrefs-top-worldwide-2026-07-all/ahrefs-top-websites-worldwide-2026-07/docs/superpowers/specs/2026-07-14-growth-report-filter-design.md

Positive Traffic Growth Filter Design

Goal

Extend the standalone 05_positive_traffic_growth.html report with two complementary filters:

  • filter traffic_28d by traffic scale and optional minimum/maximum values;
  • filter keywords by the number of words in the keyword.

The generated report must remain directly usable through file:// with no server or external JavaScript dependency.

Scope

The change applies only to the positive-growth report generated from growth_template.html. The ordinary category/monthly indexes and the 08_growth_keywords_query_domains.html report are unchanged.

The generator remains the source of truth: update the template and rebuild 05_positive_traffic_growth.html rather than editing only the generated HTML.

Filter Controls

The existing filter bar gains:

  1. A keyword word-count selector with these choices: - all word counts; - exactly 1 word; - exactly 2 words; - exactly 3 words; - 4 or more words.
  2. A 28-day traffic-scale selector with these choices: - all traffic levels; - K level: 1,000 <= traffic_28d < 1,000,000; - M level: traffic_28d >= 1,000,000.
  3. A minimum 28-day traffic input.
  4. A maximum 28-day traffic input.

Minimum and maximum inputs accept plain numbers and case-insensitive K, M, or B suffixes, including decimals such as 500, 10K, and 1.5M. Blank inputs impose no bound. Invalid nonblank bounds are visibly marked invalid and are not applied until corrected.

All filters use AND semantics with the existing keyword text, domain, and category filters.

Keyword Counting

Before counting, a keyword is trimmed and consecutive whitespace is collapsed. Words are separated only by whitespace:

  • local llm is 2 words;
  • three word keyword is 3 words;
  • text-to-video is 1 word;
  • a Chinese, Japanese, or Korean phrase without spaces is 1 word;
  • a blank keyword is 0 words and matches only the unfiltered state.

This matches the repository's existing keyword-count convention used by the growth-domain report.

Traffic Parsing and Filtering

The existing parseMetric function remains the single numeric parser for displayed Ahrefs metrics. It already handles commas, currency/percent symbols, and K/M/B suffixes. The traffic-scale and bound filters use its numeric result.

When any traffic filter is active, rows with a missing or unparseable traffic_28d value are excluded. Bounds are inclusive: a minimum of 10K includes 10K, and a maximum of 1M includes 1M.

Layout and Accessibility

The controls remain inside the fixed filter area. Desktop layout expands to accommodate the new selectors and inputs without changing the table. Narrow screens continue to collapse controls to a single column.

Each control has an explicit label. Invalid traffic bounds set aria-invalid="true" and use the existing red palette for a visible border/focus indication. The report's current-result metrics update from the fully combined filter result.

Data Flow

  1. Input/change listeners update the in-memory filter state.
  2. filteredRows() normalizes the text queries, parses the traffic bounds, validates bound inputs, and evaluates every embedded row.
  3. The complete filtered result is sorted with the existing full-result sorter.
  4. Progressive rendering resets and draws the first 200 matching rows, then appends more rows while scrolling.

Testing

Automated tests must first fail for missing controls and behavior markers, then pass after implementation. They cover:

  • the presence and labels of the word-count, traffic-scale, minimum, and maximum controls;
  • K/M scale boundaries;
  • inclusive minimum/maximum traffic bounds using suffix input;
  • exact and 4+ word-count behavior;
  • preservation of the standalone embedded-data report and progressive rendering.

After regeneration, browser verification must open the file:// report and confirm:

  • K-only and M-only filters return only the requested traffic scale;
  • a combined minimum/maximum range accepts K/M syntax;
  • 1-word, 2-word, 3-word, and 4+-word filters return correct rows;
  • filters combine with keyword search;
  • clearing filters restores the full positive-growth result;
  • no console errors occur.

Non-goals

  • No changes to source CSV data or the positive-growth selection rule.
  • No pagination, server-side filtering, URL persistence, or saved filter presets.
  • No changes to other generated reports.

本文档为站内渲染。原始文件本地路径:saas/source/keywords/关键词-ahrefs-top-worldwide-2026-07-all-ahrefs-top-websites-wor-a464e6.md(仅本地保留,不入库不部署)