---
title: "Using the Sitecore Discover beacon"
slug: "using-the-sitecore-discover-beacon"
abstract: "Gives an overview of the Sitecore Discover Beacon."
---
# Using the Sitecore Discover beacon

The Discover beacon (`init.js`) is a single line of JavaScript configured specifically for your account that enables your site to integrate with the analytic and personalization services offered by Sitecore Discover. The beacon automates many tasks required for Discover to work as intended, such as loading personalized experiences and tracking user information and behavior.

To access this functionality, [include the Discover beacon](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/get-started-with-your-discover-integration/using-the-sitecore-discover-beacon/include-the-sitecore-discover-beacon.html "Include the Sitecore Discover Beacon") in the `<head>` portion of all webpages that uses Discover services.

> [!note]
> You must use the Sitecore Discover beacon with the runtime JS integration scenario. You can also use it with the REST API integration scenario. However, you cannot use it for native apps.

<details>
<summary><h2>Sitecore Discover beacon functionality</h2></summary>

The Sitecore Discover beacon manages many complexities of tracking users and events. Its functionality differs depending on whether you are using runtime JS or REST APIs.

### Loads Discover widgets

If you have chosen to use the [Discover runtime JavaScript integration](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/get-started-with-your-discover-integration/integrate-with-discover-runtime-js.md "Integrate with Discover runtime JS") for your site, the beacon is required for displaying Discover widgets.

> [!note]
> **Notice**
> This functionality is not relevant to the REST API integration.

For example, to display a Discover widget on your website, two pieces of code are necessary: The beacon must be included in the `<head>` portion of the website, and there must be a placeholder `<div>` tag that connects to the widget using its `rfkid`.

In this scenario, a `<div>` tag displays a Discover widget with an `rfkid` of `"rfkid_1"` using the following code:

```HTML
<head>
  <script type="text/javascript" src="<your custom url>" async="true"></script>
  ...
</head>
...
<div data-rfkid="rfkid_1"></div>
```

The placeholder tag in this example displays a variety of personalized recommended products, popular categories, or whatever content is configured for this widget in the Customer Engagement Console (CEC).

### Tracks visitors

The Discover beacon [tracks users](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/get-started-with-your-discover-integration/tracking-site-visitor-information.md "Tracking site visitor information") by assigning them a unique, anonymous user ID (`uuid`).

If you have integrated using runtime JS, the beacon automatically associates the `uuid` with every action the user takes on your site.

If you have integrated using REST APIs, you must [send the `uuid` to Discover in the event object.](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/get-started-with-your-discover-integration/tracking-site-visitors-using-rest-apis.md "Tracking site visitors using REST APIs")

### Tracks events

The Discover beacon automatically tracks the following events, which are used for analytics and page customization:

- *Page views* - the beacon automatically captures page view events and sends them to Sitecore Discover, where they are converted to product views based on URI resolution. This is done for both the runtime JS and REST API integration scenarios.
- *Discover widget events* - if you have integrated using runtime JavaScript, the beacon automatically tracks user views and clicks on Sitecore Discover widgets. If you are using REST APIs, you must send widget events using [the Events API](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/get-started-with-your-discover-integration/integrate-using-the-events-api.md "Integrate using the Events API").

> [!important]
> In both the runtime JS scenario and the REST API scenario, the Discover beacon does not track [funnel events](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/get-started-with-your-discover-integration/funnel-events.html "Funnel events") automatically. You are responsible for sending funnel events using the [rfk.push() function](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/get-started-with-your-discover-integration/tracking-events-using-sitecore-discover-runtime-js.html "Tracking events using Sitecore Discover runtime JS") or [the Events API](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/get-started-with-your-discover-integration/integrate-using-the-events-api.html "Integrate using the Events API").

</details>

<details>
<summary><h2>Sitecore Discover beacon performance</h2></summary>

When you include the Sitecore Discover beacon on your site, it is loaded asynchronously so it does not adversely affect website performance.

Furthermore, the beacon loads extremely fast. Our performance metrics show that network calls for the Discover beacon take under 10 milliseconds to get a response from our servers. Then, the beacon generally loads on the website within 100 milliseconds. Even if the rest of the website was waiting for the beacon to load, it would still have a negligible impact on the load time.

</details>