Set up geofences

PremiumThis feature is available for Premium plans. EnterpriseThis feature is available for Enterprise plans. Updated

When someone enters or exists a physical location with your app, geofences lets you trigger a journey, update a segment, or send a message.

 Rollout in progress

We are currently rolling out this feature. If you’re on a premium or enterprise plan and can’t sync geofences yet, hang tight!

Geofences help you meet your customers where they are—literally. Send retail and Quick Service Restaurant (QSR) promotions, travel information, parking reminders, venue welcome messages, or delivery notifications based on people’s locations.

How it works

A geofence is a virtual boundary you draw around a real-world place—like a store, gym, airport, or parking lot. When someone with your app on their phone crosses that boundary, Customer.io records a Geofence event you can use to trigger an automation, create a segment, or control the flow of people’s journeys.

A pin appears on a map that matches the address.
A pin appears on a map that matches the address.

You group geofences into geofence sets. A geofence set lets you treat many geofences as one target, so an automation or segment can act on all of them at once. For example, you might group all of your stores into a geofence set, and trigger an automation when a person enters any of the geofences in the set.

You create geofences in your workspace. Then our mobile SDKs detect when someone crosses one and they send the event back to Customer.io.

flowchart LR subgraph cio [Customer.io workspace] A[Create
geofence] end subgraph mobile [Mobile app] B[SDK syncs
geofence list] C[OS detects
enter/exit] D[SDK sends
geofence event] B --> C C --> D end subgraph cio2 [Customer.io workspace] E[Event tracked
on person's
activity log] end A --> B D --> E style cio fill:#e1f5fe,stroke:#01579b,stroke-width:2px style cio2 fill:#e1f5fe,stroke:#01579b,stroke-width:2px style mobile fill:#fff3e0,stroke:#e65100,stroke-width:2px

Geofence boundary detection happens on the device. When the SDK refreshes nearby geofences, it sends the device’s current coordinates without a profile identifier so Customer.io can return nearby fences. The transition event stored on the person’s profile does not include precise coordinates.

Geofence transitions are not instantaneous. Detection and delivery time varies with the operating system, device movement, location accuracy, background restrictions, and network availability. Events may arrive within tens of seconds, but can take several minutes.

Refer to the mobile SDK documentation for version requirements, location permissions, and more.

Create a geofence set

In your workflows, you can add conditions for geofence sets, not individual geofences. So when you create geofences, first consider if you want to take action on them collectively. If not, that’s a signal to create multiple geofence sets to separate your geofences into.

Every geofence belongs to a geofence set. You either add a geofence to an existing set or create a geofence set followed by a geofence.

Under Configure data in the lefthand menu, go to Geofences, and then click Create a new geofence set. You only need to give it a name, but make sure it’s easy to understand so you can find it when creating automations, segments, and conditions.

After you create a geofence set, you can either import multiple geofences—names, coordinates, and the radii of the fences, or add them manually.

Import multiple geofences

To import multiple geofences, first create a geofence set. Then you create either a GeoJSON file or CSV file with the required fields. You can import up to 10,000 geofences per geofence set, and the file must be less than 32 MB. Each geofence is a a certain radius from a point; you can’t import polygon or custom shapes at this time.

  1. Select a geofence set.
  2. Click Import.
  3. Upload a GeoJSON or CSV file.
  4. Decide how to run the import:
  5. Click Import files.

You can preview the geofences after importing.

GeoJSON

GeoJSON is a geospatial data interchange format based on JavaScript Object Notation (JSON). You can learn about the spec through the IETF and validate your spec before import at geojson.io.

This is an example of a single geofence in the GeoJSON spec:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "id": "hq-sf",
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.4194,
          37.7749
        ]
      },
      "properties": {
        "name": "HQ",
        "radius": 250
      }
    }
  ]
}

All fields are required by the GeoJSON spec:

FieldDescription
typeMust be “FeatureCollection”
featuresAn array of objects, where each object is a geofence
features.typeMust be “Feature”
features.idA unique identifier for the feature; if you leave this blank, Customer.io generates a UUID
features.geometryAn object with a type and coordinates
features.geometry.typeMust be “Point”; Customer.io does not support other geometry types at this time
features.geometry.coordinatesArray of coordinates: [<longitude>, <latitude>]
features.propertiesAn object with a name and radius
features.properties.nameThe name of your geofence
features.properties.radiusInteger. Represents radius in meters. Must be within 100–10,000.

CSV

To import multiple geofences from a CSV file, create a CSV file with these fields. All fields are required except where noted:

FieldDescription
nameThe name of your geofence
radiusInteger. Represents radius in meters. Must be within 100–10,000.
longitudeThe longitude of your geofence
latitudeThe latitude of your geofence
external_id(Optional) A unique identifier for the feature; if you leave this blank, Customer.io generates a UUID

From the import UI, you can download a CSV template to help you create your file.

Create a geofence manually

To create a geofence through the UI, first create a geofence set.

  1. Select your geofence set.
  2. Click Create geofence.
  3. Search for the place, business, or address or select Coordinates to specify a longitude and latitude.
    A pin appears on a map that matches the address.
    A pin appears on a map that matches the address.
  4. Specify the Radius in meters from your location. Each geofence is a a certain radius from a point; you can’t add polygon or custom shapes at this time.
  5. Add a Name to easily identify your geofence and use it across your workflows.
  6. (Optional) Add an identifier; otherwise, your workspace generates one for you.

Sync shared geofences across geofence sets

You can share a geofence across geofence sets so the same physical location stays in sync across your sets.

For example, imagine you have two geofence sets, one is for grocery stores and another is for convenience stores. Sometimes a grocery store is also a convenience store so you create a geofence around the same store in both sets. You tie them together by giving them the same ID. If later you update the radius of the geofence, every geofence that shares that ID updates to match the new settings.

To share a geofence with another set, import it into that set using the same external_id. Customer.io keeps one fence record, so later edits apply everywhere it’s used. For example, if you update the geofence, like its radius, in the UI, that updates the radius across geofence sets.

Use geofences in your workflows

You can use geofences in a variety of ways:

Track geofence events

When people move in or out of your geofences, Customer.io logs Geofence Enter and Geofence Exit in your activity logs. Filter for the behavioral event type Geofence to see all geofence transitions in your workspace.

A geofence enter event with the payload expanded.
A geofence enter event with the payload expanded.

Each event carries the geofence_id of the geofence boundary that was crossed and the geoset_id that the geofence belongs to. The activities do not send back exact coordinates of your customers, only data for the geofence they crossed.

A geofence enter or exit event fires when a person enters or exits any geofence within a geofence set. However, keep the following in mind:

  • Geofence transitions are not instantaneous. Detection and delivery time varies with the operating system, device movement, location accuracy, background restrictions, and network availability. Events may arrive within tens of seconds, but can take several minutes.
  • There is a cool down period of 1 hour. This means if a person enters, exits, then re-enters the same geofence within an hour, the SDKs only send one geofence enter event.

Report on geofence events

You can export geofence events through data warehouse syncs. They come with the Events schema in your export files with type = geofence.

Geofence events don’t currently come with destination actions in other data out integrations.

Export a list of geofences

You can export geofence metadata by going to a geofence set and clicking Export.

Edit a geofence in use

When you edit geofences in use in your workspace—as an automation trigger, segment condition, or wait until condition—changes reach devices on their next SDK refresh. Depending on the platform and the device’s current location, a geometry change may produce a transition after it is applied.

For example, if you expand the radius of a geofence that’s part of an automation trigger, the automation could suddenly trigger for more people in the area. Similarly, if you shrink the radius, people could suddenly exit the automation.

You can filter for automations triggered by geofences from the Automations page.

Delete a geofence in use

You can’t delete a geofence set in use; you first have to remove it from any automation or segment that uses it.

However, you can delete individual geofences from a geofence set that’s in use. Deleting a geofence does not trigger a geofence transition event, which is what causes people to enter or exit automations. Deleting a geofence does not log a Geofence Exited event on a person’s profile.

So if you have an automation triggered by entering a geofence set and then deleted one of its geofences, people who entered the geofence initially would not exit the automation, even if the exit condition was “Exited Geofence Set”.

Current limitations

The following are not part of the initial release. Reach out to product@customer.io with your use case if you want to request a feature.

  • Polygon (non-circular) geofences
  • Dwell-time triggers (time spent inside a region)
  • Import of address-to-coordinate geocoding (This is available when creating geofences in the UI, just not through bulk import.)
  • Scheduling based on time of day
  • A/B testing for geofence triggers
  • Anonymous profiles

Troubleshooting

To troubleshoot issues with geofences, like entrances and exits not triggering as you’d expect, start with the SDK docs. Keep in mind, your customers must enable location permissions for you to track geofence transition events:

Copied to clipboard!