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 in the <head> portion of all webpages that uses Discover services.


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.

Sitecore Discover beacon functionality

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 for your site, the beacon is required for displaying Discover widgets.


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:

  <script type="text/javascript" src="<your custom url>" async="true"></script>
<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 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.

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.


In both the runtime JS scenario and the REST API scenario, the Discover beacon does not track funnel events automatically. You are responsible for sending funnel events using the rfk.push() function or the Events API.

Sitecore Discover beacon performance

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.

Do you have some feedback for us?

If you have suggestions for improving this article,