> For the complete documentation index, see [llms.txt](https://docs.edgetag.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.edgetag.io/features/offline-events.md).

# 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 call](https://app.edgetag.io/docs/http) or send tag via [JavaScript SDK](https://app.edgetag.io/docs/js). In this guide, we will focus on JavaScript approach.

### Initialization <a href="#initialization" id="initialization"></a>

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.

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

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

### Sending event <a href="#event" id="event"></a>

After successful initialization, everything else works the same as for online events. You can read more in [our guide](https://app.edgetag.io/docs/js).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.edgetag.io/features/offline-events.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
