Skip to content

add geotargeting addon#303

Open
etiennelatendresse-optable wants to merge 3 commits into
masterfrom
add-geotargeting
Open

add geotargeting addon#303
etiennelatendresse-optable wants to merge 3 commits into
masterfrom
add-geotargeting

Conversation

@etiennelatendresse-optable

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

Copy link
Copy Markdown

Why

Currently, no geotargeting addon or default functionality exists in the web sdk repo. The logic for it only exists in optable-mediavine-solution so only for one specific tenant.

What Changed

  • Add a geotargeting addon based on the mediavine solution

How to Test

  • Tested
  • Docs / README updated

Notes

It currently uses a DEFAULT_GEO_MAP based on the mediavine implementation. Its worth making sure that this would be valid for everyone.

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>
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