add geotargeting addon#303
Open
etiennelatendresse-optable wants to merge 3 commits into
Open
Conversation
Generalizes the geo-based host/node resolution from the mediavine solution wrapper (getGeoConfig/geoMap) into a reusable addon: the tenant name is a parameter instead of being hardcoded, and the visitor geo is passed explicitly. Returns null for unsupported geos so callers can skip region-specific initialization. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Reject geos inherited from Object.prototype (e.g. "constructor", "__proto__") which bypassed the unsupported-geo guard and produced a bogus "<name>undefined.optable.co" host - Type GeoConfig.node as string | undefined instead of string | null so the result spreads directly into InitConfig under strict TS - Accept geo: string | undefined, matching the documented and tested missing-geo behavior - Share one EU entry between GB and UK so they cannot drift apart - Expose getGeoConfig to script-tag consumers via window.optable.utils - Document that DEFAULT_GEO_MAP reflects a specific provisioning shape and that differently provisioned tenants must pass their own GeoMap Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The addon is meant to be imported dynamically by bundles that need it, not shipped always-on via window.optable.utils. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mosherBT
approved these changes
Jul 17, 2026
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.
Why
Currently, no geotargeting addon or default functionality exists in the web sdk repo. The logic for it only exists in
optable-mediavine-solutionso only for one specific tenant.What Changed
How to Test
Notes
It currently uses a
DEFAULT_GEO_MAPbased on the mediavine implementation. Its worth making sure that this would be valid for everyone.