For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to manage geofencing with Batch?

Use GPS and city-level location data to send relevant messages to users near your stores, events or areas of interest.

Location is one of the strongest relevance signals for a message: a store opening nearby, a weather alert in a given city, an offer valid in a specific area. Batch provides two native location attributes, Last location and City, that you can use directly in your targeting without any additional tool.

This guide explains how to use these native attributes to build location-based orchestrations, and how to go further with real-time geofencing by connecting a location technology provider such as Woosmap.

Choose the right location signal

Batch offers two native location attributes. They answer different needs and do not have the same level of precision.

Last location

City

Source

GPS coordinates sent by your mobile app through the Batch SDK

IP-based geolocation, detected automatically by Batch

Precision

Precise (GPS), down to a radius of a few meters

City level, varies with the network connection

Platforms

iOS and Android apps

iOS, Android and Web

Freshness

Last 12 hours only

Refreshed every time the user opens the app or visits the website

Implementation

Requires a development in your app

No development required

Typical use cases

Proximity to a store, an event venue, a station

Local events, regional offers, weather-related communications

Geotargeting vs. geofencing. The native attributes let you target profiles based on where they were recently seen, when your orchestration runs. They do not detect the exact moment a user enters or leaves an area. To react in real time to an entry or exit, use a geofencing provider as described in Go further with a location technology provider.

Prerequisites

Before you start, make sure you have:

  • For Last location: a mobile app integrating the Batch SDK, and location permission granted by your users in the app.

  • For City: the Batch SDK integrated in your app or website. No additional configuration is needed.

Step 1: Collect the user location

Your mobile app sends the user's GPS coordinates to Batch using the native location tracking method of the SDK. Share the following snippet with your development team:

An equivalent method is available on Android. See Tracking user location in the SDK documentation for details.

Your app remains responsible for requesting location permission from the user and deciding when to send a location, for example at app launch or when the user opens a store locator.

No action is required. Batch automatically detects the city of your users based on their IP address every time they open your app or visit your website.

If several installations are attached to a profile, Batch uses the city of the last active installation.

IP-based geolocation tends to be more accurate when users are connected to a Wi-Fi network. On mobile networks, the detected city can correspond to the location of the carrier's infrastructure rather than the actual location of the user. You can check the value detected for your own installation with the debug tool.

Step 2: Build your location-based targeting

Location attributes are available in the Query Builder, on all orchestration creation interfaces and in Segments.

1

Open the targeting

Create a new Campaign, Automation or Segment, and go to the Targeting section.

2

Add a location condition

Click Add condition, then select the attribute you want to use in the Built-in data:

  • Last location: define a reference address and a radius in meters. Batch targets profiles detected within this area during the last 12 hours.

  • City: select one or several cities.

3

Check the estimated reach

Review the Estimated reach before saving. A low reach on Last location usually means few users opened the app near the area during the last 12 hours.

See Targeting for the complete list of targeting options.

Go further with a location technology provider

The native attributes cover most geotargeting needs. Some use cases require more advanced capabilities:

  • Real-time triggers: send a message when a user enters or leaves a specific area, for example a store, an airport or a stadium.

  • Large point-of-interest networks: manage hundreds or thousands of areas, with their opening hours and attributes.

  • Behavioral location data: dwell time, visit frequency, home or work areas, regions visited.

Location technology providers such as Woosmap specialize in these capabilities. Their SDK monitors the areas you define directly on the device and detects entries, exits and visits. You then send these detections to Batch as events and profile attributes.

How the flow works

1

The provider detects a location event

The provider SDK, integrated in your app, detects that the user enters an area you configured, for example the surroundings of a store.

2

The event is sent to Batch

The detection is sent to Batch as an event, for example geofence_entered, with attributes describing the area, for example store_id, store_name or region. Two options are available:

  • From the app: your app forwards the detection to the Batch SDK with the standard event tracking methods. See Events.

  • From a server: the provider sends the detection to your backend, for example through a webhook, and your backend calls the Profile API.

3

Batch triggers the orchestration

A Trigger Automation starts when Batch receives the event, and sends the relevant message on the channel of your choice: push, In-App, email or SMS.

Use the data in your orchestrations

Once location data reaches Batch, you can use it like any other custom data:

Data sent to Batch
Type
Example
Usage

Entry in an area

Event

geofence_entered with store_id, store_name

Trigger a welcome push when the user arrives near a store

Exit from an area

Event

geofence_exited with store_id, dwell_time

Send a satisfaction survey after a visit

Favorite store

Profile attribute

favorite_store

Personalize messages with the closest store

Home region

Profile attribute

home_region

Segment campaigns by region

Event attributes vs. profile attributes. Event attributes describe the detection and stay attached to the event, for example the store entered. Use them to trigger and filter. Profile attributes describe the person durably, for example the favorite store. Use them to segment and personalize.

Notes

  • Location data is personal data. Collect GPS coordinates only with the consent of your users, in accordance with the applicable regulations and with the location permission settings of iOS and Android.

  • Last location relies on the mobile SDK and is not available on the Web. City is available on all platforms.

Last updated