All Collections
User Guides
Events: Creating a Geofence Alert
Events: Creating a Geofence Alert

Learn to create a geofence to trigger an event when a device leaves a particular boundary.

Sergio M avatar
Written by Sergio M
Updated over a week ago

Geofencing is a powerful feature that uses GPS to define geographical boundaries. With Ubidots, you can create an event that triggers when a device enters or exits that area.


  • Active Ubidots licensed account.

1. Creating an event with a geofence trigger

1.1. Triggers

To begin, head to the “data” tab →"Events" and hover over the “+” button, located at the upper right corner of the screen, and create a conditional event, global event, or scheduled event depending on your needs.

Once the event modal pops up, you’ll find yourself in the first stage of configuration, where you’ll set up the logic of the triggers. This is where we’ll configure our geofence alert.

1. Click on the “+ add trigger” or “+ add OR group” buttons and select “geofence”. By default, a newly created event loads with a value based trigger created, but you can either delete or configure it as well if it fits your needs.

2. Select one variable per conditional expression. Multiple variables can be added using AND (“+ add trigger”)/OR (“+ add OR group”) conditionals.

Note: The chosen variable must either be devoted to tracking the device’s position or include that information within its context.

3. Click on the “set geofence” button to create the geofence. You can select whether to draw a circle or a polygon from the upper right corner of the geofence modal, and then draw your geofence on the map.

  • Polygon:

  • Circle:

4. Define whether the event will be activated when the device enters or exits the geofence by selecting the desired option in the “trigger on” dropdown.

5. Finally, define after how long the event will activate if the previously configured conditions continue to be true.

If you leave this option at the default “0”, then as soon as the device enters or exits the geofence the event will be activated. If, for example, you choose 5 minutes here, then the event will only activate if the device is inside/outside the geofence after that time has elapsed; on the other hand, if the device returns to its normal position after 4 minutes the event won’t be activated.

Based on the previous idea, it makes sense to define this time according to the rate at which your device’s location data is updated.

1.2. Actions

After finishing all the steps in the “triggers” tab and clicking on “next”, you’ll move onto the “actions” tab. There, you’ll be able to select and configure the action that will be triggered when the event is activated.

  1. Click on the “+ add action” button to start this process. These are the options you can choose from:

For a detailed explanation on how each of the actions work and how to configure them, visit their respective article (linked above).

1.3. Settings

After completing the action configuration and clicking on “next”, you’ll proceed to the final step, the “settings” tab. There, you’ll identify your event and define its active windows.

  1. Start this stage by naming your event and, optionally, giving it a description so that it’s easy to distinguish from other events later on.

  2. Another optional step is to use a tag on the event. This is a great tool to control what your end users see in your app. In this case, for instance, you could decide that your end user sees one event, but not another, using tags. Learn more about tags here.

  3. Determine the activity window in which the events should be executed. An event can have multiple active windows by clicking on the “+ add window button” and configuring them correspondingly. To learn more about how and when an event is activated, head to this guide.

Did this answer your question?