Offline Events

The power of joining online and offline events in complex flow is essential, and in this guide, we will show you how to do it.

We need to cover one concept first, connecting the user. Our SDK automatically generates a user ID for online events and persists it in the browser. But the problem starts with offline events, where every event is more or less isolated. Because of that, you will need to make sure that you read the online ID and store it in your backend. This way, when you are doing offline events, you can read it from your database and connect the user.

You have two options for how to send offline events. You can write a HTTP callarrow-up-right or send tag via JavaScript SDKarrow-up-right. In this guide, we will focus on JavaScript approach.

Initialization

Same as for online collection, we first need to initialize our SDK. It will get the latest providers and set things up. In this step, we must pass the user ID in the initialization parameters you stored in your backend. Passing ID will connect your online and offline events to the same user.

import { init } from '@blotoutio/edgetag-sdk-js'

init({
  edgeURL: 'https://d.mysite.com',
  disableConsentCheck: true,
  userId: '123456'
})

Sending event

After successful initialization, everything else works the same as for online events. You can read more in our guidearrow-up-right.

Last updated

Was this helpful?