Repository navigation
feat: optional US state-level geo-targeting for AI prompt tracking - #579
Merged
Merged
Conversation
Brands with region US can now pick an optional USPS state; the tracking worker forwards it to the scraping provider so AI answers localize to that state. - 00043 migration: nullable brands.state (two-letter check); NULL keeps today's nationwide behavior for every existing brand - Static US_STATES list (50 + DC) in web config — no runtime dependency on the provider's states endpoint - State select (visible only when region is US, with an explicit Nationwide option) on the Add Brand step, onboarding market step, and brand settings General tab; switching region away from US clears it in the UI and in updateBrand - buildRequestBody adds state only when country is US and the task is an AI endpoint (chatgpt-web/-shopping, copilot, grok, perplexity, gemini); Google AIO / AI Mode payloads are untouched — 6 new tests Closes #554
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
US brands can now optionally pick a state (USPS two-letter code) and get state-localized AI answers: the tracking worker forwards the state to the scraping provider on AI-endpoint tasks, which routes the request through an in-state proxy.
00043migration — nullablebrands.statewith a two-letter CHECK;NULL= nationwide, so every existing brand keeps today's behavior. Already applied to the hosted DB.US_STATESlist (50 states + DC) inweb/src/config/prompt-options.ts— no runtime dependency on the provider's states endpoint.US, includes an explicit "Nationwide (no state)" option, and switching the region away fromUSclears the value both in the UI and inupdateBrand.brands.stateand passes it tosubmitScraperTask;buildRequestBodyincludesstateonly whencountry === 'US'and the task is an AI endpoint (chatgpt-web,chatgpt-shopping,copilot-web,grok-web,perplexity-web,gemini-web). Google AIO / AI Mode payloads are untouched — they use a different sub-country mechanism.Related issue
Closes #554
Type of change
feat— New featureHow to test
US, pick a state and save; switch region to another country — the state field disappears and the stored value clears.US+ a state; verifybrands.stateholds the code.state;google-aio/google-aimodepayloads don't.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)