Skip to content

The ip2location module ​

Part of the SharedID Edge specification. The general rules for modules, including consent, time limits and merging in SID_MODULES order, are there.

Name ip2location; no purposes, no gvlid; routes v1 only. A vendor module (packages/vendor-modules/ip2location), added at build time, that runs only when listed in SID_MODULES. It looks the client IP up in two tables built at build time: the country from IP2Location LITE DB1, and proxy signals from IP2Proxy LITE PX10. Both are downloaded with the deployer's free IP2Location download token and make no network calls. The token is used only by the build and MUST NOT be in the bundle.

  • Country lookup: the client IP (PlatformInfo.clientIp, IPv4, IPv6, or IPv4-mapped IPv6 as IPv4) in the bundled DB1 table. IPv4 results MUST equal the database's. IPv6 is keyed by the address's first 64 bits: a /64 that the database splits between countries takes the country of its first address. A missing or unparsable client IP, an address without data, or a country code with no ISO 3166-1 alpha-3 equivalent (such as XK) is a miss for the country.
  • Country output: { "device": { "geo": { "type": 2, "country": <ISO 3166-1 alpha-3>, "ipservice": 1 } } }, merged into ortb2. ipservice is 1, IP2Location in AdCOM 1.0's List: IP Location Services, and is sent only with the module's country.
  • Traffic lookup: the same client IP in the bundled PX10 table, whose values are one or more proxy kinds separated by commas. A record with several kinds keeps the most specific, in core's PROXY_KINDS order (tor, residential, relay, vpn, public, datacenter). is_anonymous alone names no kind. A miss adds no traffic signal.
  • Traffic output: ModuleResult.traffic as { "proxy": <kind> }, which core merges into ortb2.device.ext.traffic with the platform's and other modules' reports and sets sources. The module MUST NOT set bot or botKind: it cannot tell a bot from a person on a proxy address, and SID_SKIP_BOTS would then withhold SharedIDs from real visitors. The signal is independent of mode.
  • mode (SID_MODULE_CONFIG.ip2location.mode), for the country only:
    • fill (the default): the module omits the country when the platform reports one (PlatformInfo.country) that has an alpha-3 code, that is, one the geo module would send;
    • replace: it returns the country whenever the lookup finds one. Listed after geo in SID_MODULES, its country overrides geo's in the merge; geo's other fields remain.
    • Any other mode, or any setting other than mode and maxAgeDays, is an error.
  • maxAgeDays (optional, positive finite number): when either bundled database's publication date is older than this age, report stale while retaining the normal last-good output (including on a miss, and when neither lookup adds anything). An invalid setting is an error. When this setting is enabled, an invalid publication date in either table is also an error.
  • Consent: the country is coarse location and the proxy signal describes the network, so both are returned whatever the consent signals (GPC, COPPA, a US privacy opt-out, GDPR with or without a TC string, opt-out), as geo returns the CDN's country. The module's output never changes core's consent decisions.
  • LITE coverage: IP2Proxy LITE PX10 is a public-proxy subset; VPN, Tor, hosting and residential coverage is in the commercial PX10 database, which the same build accepts through --proxy-file. A deployment MUST NOT treat the LITE signal as full proxy detection.
  • The tables without real data (the package's fixtures) cover only documentation addresses: the country fixture is the shared one (192.0.2.0/25 FR, 192.0.2.128/25 XK, 198.51.100.0/24 JP, 203.0.113.0/24 BR, 2001:db8::/48 FR, 2001:db8:1::/48 JP); the proxy fixture maps 192.0.2.0/26 tor, 192.0.2.64/26 vpn, 192.0.2.128/26 residential, 192.0.2.192/26 public, 198.51.100.0/25 public,datacenter, 2001:db8::/48 tor and 2001:db8:1::/48 vpn. The conformance cases (conformance/cases/module-ip2location*.json) use them.
  • Nothing about the request is stored or logged.