> 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/implementation/headless/initialization.md).

# Initialization

To begin using EdgeTag, you need to add our [NPM package](https://www.npmjs.com/package/@blotoutio/edgetag-sdk-js) and initialize it. You can add our package to your project by running the following command:

```bash
npm i @blotoutio/edgetag-sdk-js
```

Now that our package is installed we need to initialize it. Our package should be initialized only once per full reload (do not initialize it when doing navigation with JS router).

{% hint style="warning" %}
Ensure you replace the example URL `https://d.mysite.com` with the one generated for you in the app.
{% endhint %}

{% code overflow="wrap" %}

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

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

{% endcode %}

Available parameters for the init function are:

| Name                | Type        | Required | Description                                                                                     |
| ------------------- | ----------- | -------- | ----------------------------------------------------------------------------------------------- |
| edgeURL             | String      | Yes      | EdgeTag URL that you received as part of onboarding.                                            |
| disableConsentCheck | Boolean     | No       | If you don't have consent on your site, you can disable it with this flag.                      |
| userId              | String      | No       | If you would like to set custom id for your first party cookie, you can pass unique identifier. |
| providers           | Provider\[] | No       | Browser pixels that need to be added for specific channels                                      |

{% hint style="warning" %}
If you would like to add any browser pixels/scripts (such as a Meta pixel), you need to install the corresponding npm packages for that specific channel. See [Browser packages](/implementation/headless/browser-packages.md) docs for more info!
{% endhint %}

{% code title="Initialization with browser pixel added" %}

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

init({
  edgeURL: 'https://d.mysite.com',
  disableConsentCheck: true,
  providers: [facebook]
})
```

{% endcode %}

Now that we have a snippet on the site and have initialized it, let's discuss multiple instances, as you can have multiple EdgeTag instances on the same site.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.edgetag.io/implementation/headless/initialization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
