Integrate the JavaScript Beacon

The Marketing Cloud Personalization module of the Salesforce Interactions SDK uses a JavaScript beacon to monitor and track the online behavior of your organization’s web users.

Before you integrate the JavaScript beacon, determine whether you want to use synchronous or asynchronous integration. For more information, see Synchronous or Asynchronous Integration.

This integration process uses the Personalization content delivery network (CDN) to host the JavaScript beacon. To assume responsibility for hosting the JavaScript beacon on your organization’s CDN, see Self-Host the Server-Side JavaScript Beacon.

  1. Log in to Personalization as an administrator.
  2. From the Channels & Campaigns section of the main navigation, select Web > JavaScript Integration.
  3. If you have more than one dataset, select the one you want from the dropdown at the top.
  4. Click the tab for the type of integration you want: Synchronous or Asynchronous.
  5. Copy the integration code for that type and place it into the HTML head element of your website to ensure that the beacon loads on every page.
  6. Repeat this process for any other datasets you have.
  7. After integration, if necessary, you can disable the JavaScript beacon by selecting Web | Web SDK Settings from the Channels & Campaigns section of the main navigation, selecting the Disabled toggle, and clicking Save. Selecting Disabled replaces the existing JavaScript beacon with an empty JavaScript resource. All event receipt, analytics, and messaging stop immediately, and propagates in minutes as viewers' browser caches expire.

Before proceeding with self-hosting the JavaScript beacon, consider the following critical aspects of doing so:

You must automate updating your SDK from the source SDK that Personalization hosts. The contents of the SDK are dynamic, so if you change various settings in Personalization, change installed gears, or make updates to your site map, the contents of the SDK can also change. If you don't update your hosted version of the SDK in tandem, your campaigns and tracking can break. At a minimum, configure the automated update to check for changes every hour.

To self-host the JavaScript beacon, you must first obtain the JavaScript beacon code and then deploy it to your organization's CDN.

  1. Log in to Personalization as an administrator.
  2. From the Channels & Campaigns section of the main navigation, select Web > JavaScript Integration.
  3. If you have more than one dataset, select the one you want from the dropdown at the top.
  4. Click the Synchronous tab.
  5. Copy the source URL, which begins after src=", from the integration code. For example, //cdn.evgnet.com/beacon/myaccount/mydataset/scripts/evergage.min.js. This link provides access to the JavaScript beacon code, which you can then deploy on your organization's CDN to self-host the JavaScript beacon.