Protecting the Privacy of Your Customers
**Make sure you have obtained and stored consent from your customers before [initializing](🔗) Bloomreach Engagement JS SDK**.
To ensure no events are tracked before obtaining consent from visitor, use the `
compliance.opt_in` option when visitors opt-in to tracking (this applies to new visitors or returning visitors who have previously opted-out). This option also prevents re-using existing cookies for returning visitors.
To find the integration snippet, open your Bloomreach Engagement project and go to **Settings > Web integration**.
Click on the _Copy to clipboard_ button and paste the snippet into every page of your website where you want to track your customers. Make sure to paste the snippet into the `
<head>` tag of the page.
Note that the new integration snippet is available in Bloomreach Engagement app since version 1.172.
### Using the older integration snippet
If you've been integrated with Bloomreach Engagement for a while, it is possible that you are using an older integration snippet. The older snippet looked like this:
You can notice that the most important visible difference is that the old snippet contains a call to [`
exponea.initialize()`](🔗), whereas the new snippet contains a call to [`
This snippet is now quite old. If you are still using it on your website, it is recommended that you update to the newer integration snippet mentioned in [the top of this page](🔗), if you have the chance. Simply delete the old snippet from your website and follow the [steps on this page](🔗) to use the new one.
The new integration snippet has support for [Non-flickering experiments](🔗) and some additional features which the old snippet lacks. Plus, the old snippet contains some really old code that is not used by SDK anymore.
When you initialize SDK, it starts communicating with Bloomreach Engagement - tracking the customer and their events, showing web layers, experiments, etc. By default, SDK is initialized as part of the integration snippet by calling `
exponea.start()` (see the snippets above).
The SDK integration snippet takes in a configuration object. By default, this configuration is pre-filled with your project token and the API target. You can also customize other SDK options, see the [Configuration page](🔗) and also the [Configuration section](🔗) on this page. Here's how:
The above shows how to enable new experiments in a async mode and customize the options.
This function is only supported in the newest integration snippet (from the release 1.172). If you are still [using the older integration snippet](🔗), please update it to the newest version.
When called, SDK is initialized and starts doing its job. This function is part of the default integration snippet so you don't have to call it manually in your code. The function can take 1 optional parameter, which is a configuration object. If specified, this configuration extends the existing configuration specified in the integration snippet.
Note that some configuration options such as `
target` and `
token` can only be used in the _configuration section_ of the integration snippet, and **not** in the call to `
|`||object||Configuration object which extends the existing configuration in the integration snippet. See the [Configuration page](🔗) and the [Configuration section](🔗) on this page for the list of supported options.|
Initialize SDK with the configuration specified in the integration snippet:
Extend the SDK configuration and initialize it. This can be useful if you have to request a configuration value asynchronously and then initialize SDK asynchronously using that value. For example, you can request your customer ID and use it when initializing Bloomreach Engagement SDK:
As you saw above in sections, the behaviour of SDK is configured using a configuration object passed into the snippet and the `
start()` method. The supported options which control the behaviour of SDK are described in [Configuration](🔗). However, there are a couple of special options which control the behaviour of the integration snippet itself. These options are described below:
Note that these configuration options can only be used in the _configuration section_ of the integration snippet, and **not** in the call to `
|Name||Default value||Possible values||Description|
|`||`||string||URL of the Bloomreach Engagement API. This value is pre-filled in the integration snippet provided by the Bloomreach Engagement app.|
|`||_none_ (this value is required)||string||Token of your Bloomreach Engagement project. This value is pre-filled in the integration snippet provided by the Bloomreach Engagement app. The SDK tracks data into this project.|
|`||`||boolean||If set to `|
|`||`||boolean or an object with options (see below)||Used to enable and control how [Experiments](🔗) are applied on your page. This option specifically enables the improved implementation. Read more [in the documentation for experiments](🔗).|
|`||`||`||Specifies whether experiments are applied synchronously (blocking the page rendering) or asynchronously (hiding the page while they are loading).|
|`||`||number||Maximum amount of time (in milliseconds) that the main page is blocked or hidden while the experiments are loading. Read more in [Integrating and using Experiments](🔗).
Note that the integration snippet does not contain any validation for correct values here. It only makes sense to provide a positive number for this option so have that in mind. `|
|`||`||string||The CSS class name of the element used to hide the main page content. This is only used in the `|
|`||`||string||Enables you to customize a file path for the service worker.
Configuring a service worker is required when `|
Here's how to overwrite the SDK file URL:
Only use the `
file_path` option if you know what you're doing. Using an incorrect SDK file could break your integration.
You can use `
exponea.version` to find out what version of SDK you are using.
You can use `
exponea.snippetVersion` to find out what version of the integration snippet you have on your website.