Geofencing

Enterprise feature

In this tutorial, you'll learn how to introduce geofencing to your campaigns and reward your customers for being in the right place at the right time. Voucherify makes it easy to keep up with customers on the move thanks to the auto-update segments dynamically reacting to location changes. 

You can create location-specific campaigns with redemption limits based on customers, products, and SKUs geolocations:

  • Decide which products or SKUs will be discounted or excluded based on their current location
  • Limit redemptions to customers who share specific locations
  • Exclude particular areas from applying the discount

Contents

  1. How does it work?
  2. Campaigns with customer location
  3. Campaigns with product and SKU location
  4. How to use the map and draw Locations? (video)

Limited access

The geofencing feature is available only in the Enterprise subscription (on demand).


How does the Locations manager work?

The Locations manager offers a few options to manager your locations.

Navigate to Locations in the Dashboard. 

  • At the top right corner, the plus sign let's you add a new location
  • At the top, you can narrow down your list of locations using filters
  • To the right of every location, you can use the tricolon ⁝ to display the following options:
    Option Description
    Show usage Shows which resources are using the location, i.e. which product collections or customer segments use the location.
    Edit Let's you edit the location name and boundaries.
    Duplicate Creates a copy of the location and let's you modify the duplicated location's name and boundaries.
    Delete Deletes the location.

When you are working on a location, you have a few options available:

Icon Description
Brings back the selected area on the map back into focus.
Allows you to add a polygon or circular boundary.
Allows you to edit the boundaries. (Edit mode)
Let's you delete the boundaries.
Zoom in and out of the map.

Geofence campaign with customer's location

Voucherify supports campaigns restricted to specific areas. When passing the customer's geolocation with a redemption/validation request, Voucherify verifies if a customer location meets campaign rules. 
Creating a geofence campaign based on a customer's location comes down to the following steps:
  1. Create a new Location object to define an area for customers eligible for a discount.
  2. Add metadata definition with a geopoint type to pass customer's geo-coordinates (latitude and longitude in geo URI format).
  3. Create a customer segment that gathers customers from the area specified by the Location object.
  4. When creating a promo campaign, add a segment-based validation rule that limits redemptions to customers from a particular location (customers that entered the customer segment).

Step 1: Define a new Location object

First, you need to define a Location object that defines the boundaries for the allowed customers' locations. Go to the Locations tab in your dashboard. 

Click the plus to add a new Location. You can now use the map or the search bar to browse and save the required location/area. After adding a location name and saving your Location, you can re-use it in future campaigns. 
Each Location object can be a single location defined by specific coordinates or a multi-coordinate area. You can highlight areas on the map using a radius or polygon tools. 
Each polygon is a set of points forming a closed region.


Step 2: Add metadata representing the customer's location

To pass the customer's geolocation to Voucherify, you need to create a new metadata definition in the Customer metadata schema. There is a dedicated metadata type, called  geopoint, which lets you send coordinates (latitude and longitude in geo URI format) specifying the customer's current location.
Go to the Project settings > Metadata schema.

Expand the standard schemas and choose Customer. Click Add new definition and define a property representing the customer's location. Remember to choose Geopoint as a metadata type. Read more about customer metadata here.


Step 3: Create area-specific customer segment

Go to the Customers tab in your dashboard and create a new auto-update segment based on the metadata property added in the previous step. The segment will gather customers that share the required location. 
Later on, this segment will be used in validation rules to limit redemptions only to customers from a predefined area.  
  1. Click Find and apply filtering.
  2. Go to Custom attributes (metadata).
  3. Choose the metadata property representing customer location. 
  4. Define segment criteria using one of your Locations. 
  5. Confirm with the plus and Apply.
In the picture above you can see the following segment condition: 
Value of customer's metadata called *customer_location* (geopoint type) needs to be included in geolocations defined within the Free shipping zone object. Both geopoint metadata and Location objects, store geolocation using coordinates (latitude and longitude).

When segment filters are ready, click Apply and save the segment. 

The segment will gather all customers who meet its rules and share the matching location. Moreover, with every update of the customer's location, Voucherify will check if he/she still meets segment rules and update the segment accordingly.


Step 4: Create a geofence promo campaign

You can choose between all campaign types offered in the Campaign Manager.
When creating a campaign, adding location-based validation rules is a key part of the process. Validation rules based on the customer segment created in the previous step will limit redemptions to customers from the specific area. 

You can add validation rules when creating a new campaign or prepare them beforehand in a dedicated dashboard section. The segment-based rule can be added in both basic and advanced Rules Builders. Read more here.

Basic builder:

Advanced builder:


Redemption

When redeeming the code, you need to pass the customer's current location using the same metadata property that was used to define the customer segment criteria. Voucherify will check if the value of metadata property assigned to the customer (current location) matches values allowed for that property by segment filters. 

Geofence campaigns with product/SKU location

Similar to customer objects, you can add product metadata of the geopoint type and pass products' locations in API requests. As a result, products from customer's orders can be validated against product-specific rules specifying locations that qualify products for discounts. 

Creating a product-specific campaign with geofencing comes down to the following steps:
  1. Log in to your dashboard and create a new metadata definition in the Product metadata schema.
  2. Create a products collection based on the added metadata property (geopoint type). 
  3. When creating validation rules for your campaigns, you can use location-based collections to introduce the following limits:
    • Only products from geolocations defined by the collection criteria can be discounted.
    • Only if a customer has products from particular geolocations, a discount can be redeemed. You can also specify how many items from a given location the customer needs to buy to make a redemption.
    • Exclude products from particular locations from getting a discount. 
    • Exclude carts with products from particular locations from making a successful redemption.

Step 1: Define a new Location object

First, you need to define a Location object that determines allowed product/SKU locations. Go to the Locations tab in your dashboard. 

Click the plus to add a new Location. You can now use the map or the search bar to browse and save the required location/area. After adding a location name and saving your Location, you can re-use it in future campaigns. 

Each Location object can be a single location defined by specific coordinates or a multi-coordinate area. You can highlight areas on the map using a radius or polygon tools. 

Each polygon is a set of points forming a closed region.

Step 2: Add a metadata property for product/SKU location

To pass the product or SKU geolocation to Voucherify, you need to create a new metadata definition in the respective metadata schema. There is a dedicated metadata type, called geopoint, which lets you send coordinates (latitude and longitude in geo URI schema) specifying a current location.
Go to the Project settings > Metadata schema.

Expand standard schemas and choose Product.
Click Add new definition and define a property representing the product or SKU location. Remember to choose Geopoint as a metadata type. Geopoint metadata enables you to pass location using coordinates separated by a comma (latitude, longitude).

Step 3: Create a location-based product collection

Collections group products and their SKUs under predefined criteria. When it comes to geofence campaigns, you need to build a collection that gathers items from a particular Location. Go to the Products menu and choose Find and apply filters

Go to the Custom attributes (metadata) and choose the geopoint metadata property added previously to the schema.

Now, build collection criteria using the geopoint metadata property and Location object created in the first step. 

Click the magnifying glass to display the list of available locations. 

You can use filters to narrow down the list of your pre-defined locations. 

Once you decide on the location you would like to use for the product, click on the check box next to the location and Select locations.

Confirm with the plus and Apply.

Note that you can add more filters to define the collection criteria. When they are ready, click Apply and Create dynamic collection.

Name the collection and save it. Now, you can use the collection to create location-specific validation rules for your products and SKUs. 

Step 4: Create a geofenced promo campaign

You can choose between all campaign types offered in the Campaign Manager.
When creating a campaign, adding location-based validation rules is a key part of the process. Validation rules based on product collections can model the required cart structure and/or define discounted/excluded items. Read more here.

You can add validation rules when creating a new campaign or prepare them beforehand in a dedicated dashboard section. To get an overview of available product-specific rules, open the advanced Rules Builder. 

When building campaign rules, you can use location-based collection twofold:

  1. You can use it to define products that will be discounted or excluded when redeeming a code or promotion. As a result, only products that share a predefined location and match collection rules will be discounted (or excluded from getting the discount). Go here for the detailed instructions.

  2. You can also define the required cart structure. It means that products or SKUs located in a particular area need to be in the cart to make a successful redemption. On top of that, you can set additional criteria for matching items, like items count and subtotal.

    To create order structure validation rules with product collections, go to the advanced Rules Builder and expand Order structure validation rules. 

    Decide if every, any, or none of the order line items needs to match the collection criteria (be in a particular location). Mark the respective checkbox.

    Click  Add and choose the area-specific product collection.

    If you chose  Every or any order item matches, you can also define the quantity and subtotal of matching items. 

Validation rules

Go here to learn more about Rules Builder and product-specific validation rules.

Redemption

When redeeming the code, you need to pass the product or SKU location using the same metadata property that was used to define the collection criteria. Voucherify will check if the value of metadata property assigned to the product/SKU (current location) matches the values allowed for that property set in the collection filters. 
"metadata": {          
    "product_location": "geo:37.786971,-122.399677"
}
	

Redemption Endpoints

Read more about redemption endpoints in our API Reference Guide.


How to use the map and draw Locations?

Watch this short video to learn how to use the map in the Locations menu and define new geofences for your campaigns.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us