Skip to content

US brands: optional state-level geo-targeting for AI prompt tracking #554

Closed

Description

@gkhngyk

Context

Cloro now supports state-level geo-targeting for the AI endpoints: passing a USPS two-letter state code alongside country: "US" routes the request through a proxy in that state and returns localized results. This applies to ChatGPT, Copilot, Perplexity, Gemini, and Grok. Google Search / AI Overview / AI Mode are not affected — those continue to use location / uule for sub-country targeting.

Today a brand only has a country-level region (default US), selected during onboarding and on the Add Brand page, and server/src/lib/cloro-scraper.js sends it as country in every request body. There is no state concept anywhere in the stack, so US customers with local intent ("best electricians near me") can't get state-localized tracking.

Scope

1. Schema

  • Add a nullable state column to brands (two-letter USPS code). Empty = nationwide, which keeps the current behavior for every existing brand. Numbered migration file under supabase/migrations/.

2. Web UI

  • Onboarding brand step and the Add Brand page (web/src/app/[locale]/(dashboard)/dashboard/brands/new/page.tsx): when the selected region is US, show an optional "State (optional)" select; hide it and clear the value when any other country is selected.
  • Brand settings: state must be editable after creation, wherever region is editable today (updateBrand in web/src/lib/actions/brand.ts already supports region updates — extend it).
  • The state list is a static constant (50 states + DC) in web/src/config/, next to REGIONS in prompt-options.ts. Do not fetch it from the provider's /v1/states endpoint at runtime — no external dependency in the UI path.

3. Server

  • Thread the brand's state through the tracking pipeline to buildRequestBody in cloro-scraper.js.
  • Include state in the request body only when country === 'US' and the task is one of the AI endpoints (chatgpt-web, copilot-web, grok-web, perplexity-web, gemini-web, and chatgpt-shopping, which uses the same CHATGPT task). Never add it to the google-aio / google-aimode payloads — those branches are already separate in buildRequestBody, so the split is clean.

Availability

Available on all plans — no plan gating.

Out of scope

  • Volume/competition analysis (DataForSEO) — unaffected, keeps country-level targeting.
  • Historical results — existing data is untouched; state targeting applies from the next run onward.

Acceptance

  • A US brand can pick a state at creation and change it later from settings; non-US brands never see the field.
  • Runs for a US+state brand send state on AI-endpoint requests only; Google AIO / AI Mode payloads are unchanged.
  • Brands without a state behave exactly as today.

Activity

  1. added
    enhancement
    on Jul 29, 2026
  2. self-assigned this
    on Jul 29, 2026
  3. added a commit that references this issue on Aug 2, 2026
    ce85112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions