Geo & location

Geo & location

Tocadule attaches location to your data in two very different places, resolved two very different ways. This page explains both so you know exactly what you get for free and what you have to send us.

  • Event location — country, region, city, postal code, timezone on every event (a visitor who did not consent: country, region and city). Resolved automatically from the visitor's IP. You do nothing.
  • Contact profile location — the country / city stored on a person's contact record. This is declared-only: it comes from what you pass in identify(), and is never guessed from an IP.

Short version: events are located by IP (automatic). Contacts are located only by what you tell us (traits.country / traits.city in identify). Location segments read the event country, not the contact record.

How event location is resolved

When an event arrives, we look up the real client IP in MaxMind GeoLite2 City, kept in our database and refreshed twice a week. MaxMind is the single source of truth for event location:

FieldExampleSource
countryTurkeyMaxMind (country name from ISO code)
country_codeTRMaxMind (ISO 3166-1 alpha-2)
regionIstanbulMaxMind
region_code34MaxMind
cityIstanbulMaxMind
postal_code34000MaxMind
timezoneEurope/IstanbulMaxMind

They are filled automatically for every event. An event that belongs to a visit keeps them once, on its visit (the visit's place is the place of its events); reports, segments and Toca read them from there.

MaxMind is the only source. CloudFront's viewer headers are not read for location, and no ASN is kept.

An event's location is always the visitor's IP location. If you send country, region, city or postal_code on an event, we treat it as that person's declared address: it is kept apart from the visit's place and used for that event's ad match, never as where the visit came from.

Precision and consent

Country, region and city are resolved for every visitor. Postal code and time zone are resolved only for a visitor who granted consent (either lane). Coordinates are not kept. Geo lookup is fail-safe: any error (bad IP, DB miss) just leaves the field unset and never blocks the event.

Contact profile location is declared-only

A contact's stored country and city come only from what the person or the store declared: the traits you pass to identify(), a contact CSV import, or the Shopify customer's default address. A popup form never sets them: a form field's answer is kept on the contact under the field's own name. In identify():

tocadule.identify('shopper@example.com', {
  first_name: 'Ada',
  last_name: 'Lovelace',
  phone: '+90...',
  country: 'Turkey',   // ← sets contact.country
  city: 'Istanbul'     // ← sets contact.city
});

We do not infer profile location from the request IP, and we never will.

⚠️

An IP tells you where a request came from — a proxy, a VPN, a phone on roaming, a corporate egress, a prefetch bot — not where a person lives. Inferring a contact's home from their first-touch IP and freezing it would permanently mislabel people (a shopper proxied through Frankfurt stamped "Germany" forever). So profile location stays declared-only.

Here is the exact identify script from the product (copy it verbatim):

<script>
  // At sign-up / login. Everything except email is optional — country + city
  // unlock location segments. Add the boxes the shopper ticked as
  // subscribed_<channel> (true when ticked) if this is a sign-up; without them nothing is subscribed.
  tocadule.identify(`{email}`, { first_name: `{firstName}`, last_name: `{lastName}`, phone: `{phone}`, country: `{country}`, city: `{city}` });
</script>

On upsert, city, region and postal_code are one address: sending any of them writes the three together (the ones you leave out are cleared), so a contact never keeps one address's city beside another's postal code. country is replaced only when you send one. A later identify without any of those traits never wipes what you already stored.

What you must do to get profile location

  1. Pass country and city (and region / postal_code when you have them) in your identify() traits, from the account or shipping address the customer actually entered.
  2. That's it. No IP ever populates contact.country / contact.city.

If you never pass them, the contact simply has no profile location — but the events that contact generated still carry full IP-derived geo for analytics and segmentation.

Location segments are event-based

The By Geo segment (under the Audience lens) filters people by where their visits came from: the country, region or city of a visit, resolved from its events' IP — not the contact record. A contact's visits are its linked browsers' visits. A place or source condition matches in any letter case (istanbul finds Istanbul).

Because visit location is IP-resolved automatically, By Geo works for every visitor — anonymous or identified, whether or not you ever called identify(). You don't need to send anything to make geo targeting work; it's on by default.

Analytics (e.g. Top Countries) read the same visit location. Contact-record country is used for contact-field filters, not for the By Geo audience template.

cart_state never carries location or PII

The cart (tocadule.cart(), or your platform's cart) carries only cart contents plus the anonymous_id. They are PII-free by design and resolve to a contact through the identity map — never put email, name, or location on the cart. The cart's location, if you need it, comes from the visitor's events.

Timezone

MaxMind supplies an IANA timezone (e.g. Europe/Istanbul) on the event when resolvable. It's an event property like the rest — useful for send-time and reporting — and, like all geo fields, is IP-derived, not declared.

Quick reference

You want…How to get it
Country/city on eventsAutomatic (IP → MaxMind). Nothing to do.
Contact profile country / cityPass traits.country / traits.city in identify()
Location targeting (By Geo segment)Automatic — reads the visit's country

Related

  • Consent — a granted lane unlocks the location below the country; the ad lane (ad_consent) gates forwarding. Email/SMS opt-in is a separate preference, not a consent lane.
  • Identify & the identity contract — how identify() links a visitor to a contact (an email on another event is only that event's ad match).