Skip to content

add geotargeting addon#303

Merged
etiennelatendresse-optable merged 3 commits into
masterfrom
add-geotargeting
Jul 17, 2026
Merged

add geotargeting addon#303
etiennelatendresse-optable merged 3 commits into
masterfrom
add-geotargeting

Conversation

@etiennelatendresse-optable

@etiennelatendresse-optable etiennelatendresse-optable commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Why

Currently, no geotargeting addon or default functionality exists in the web sdk repo. The logic for it previously only existed in per-customer SDK wrappers, so only for specific tenants.

What Changed

  • Add a geotargeting addon that maps a visitor geo to the Optable host/node serving them

How to Test

  • Tested
  • Docs / README updated

Notes

Most publishers only have infrastructure in North America, not in all the regions.

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>
@etiennelatendresse-optable
etiennelatendresse-optable merged commit 7e122f1 into master Jul 17, 2026
7 checks passed
@etiennelatendresse-optable
etiennelatendresse-optable deleted the add-geotargeting branch July 17, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants