Segment integration

Bluedot is a location platform that provides an accurate and simple geofencing platform for apps. After integrating the Bluedot SDK and setting geofences, customer’s can create personalised location-based experiences for their users.

Segment provides the customer data infrastructure that helps businesses put their customers first. Using Segment, companies can collect, unify and connect their first-party data to over 200 marketing, analytics and data warehouse tools.

With this integration, Bluedot’s first-party, accurate, and privacy compliant location data can be connected and utilised across all of the platform and apps supported by Segment.

Integration Architecture

Integration Overview

Before you begin the integration please ensure you have an active customer account with both Bluedot & Segment.

We will be using Segment – Source Functions to pass Bluedot Entry/Exit events to Segment.

1. Decide on the custom data you’ll be passing from Bluedot Entry/Exit (can also be called Check-in and Check-out Event) Events to Segment:

a. Custom Event Metadata (max. 20)
b. Custom Zone Data (max. 20)

2. Integrate the Bluedot SDK within your mobile app:

a. Android integration guide
b. iOS integration guide

3. Create a Segment – Source Function to accept Bluedot events as per Segment’s documentation.

a. If you are using Bluedot’s installRef to identify a user in Segment than you can set up the function as follows:

async function onRequest(request, settings) {
    const body = await request.json();
    Segment.track({
        event: body.type,
        userId: body.installRef,
        properties: { ...body }
    });
}

b. If you are using your own identifier to identify a user in Segment then you can set up the function as follows:

async function onRequest(request, settings) {
    const body = await request.json();
    Segment.track({
        event: body.type,
        userId: body.eventMetaData.<your-identifier>,
        properties: { ...body }
    });
}

4. Deploy the Segment – Source function.

5. Setup a Webhook for the project in Bluedot Canvas. Use the URL available in the settings section of the deployed Segment – Source Function. You can leave the Token key and value fields blank. More information on how to connect Segment – Source Functions is here.

Once these steps are done, the integration is ready to go. Simply enter a geofence with a mobile device to trigger the Zone.

Custom Event Metadata in Bluedot events

More information on best practices of setting and using custom event metadata can be found here.

image

The custom event metadata is not persisted across SDK sessions. If the SDK is logged out the custom event metadata is cleared by the SDK. We suggest setting the custom data every time the SDK is authenticated in the app.

Webhook fields passed to Segment – Source Functions

More information on the fields passed via entry/exit events Bluedot webhooks are here.

Created by Melwin Chiramel on June 9, 2021