Skip to main content
The signals beacon is an embeddable tracker that captures signals corresponding to user actions, like searches and purchases. Add the beacon script to your site’s <head> once. After that, you can manage what it captures entirely from Lucidworks Platform. No further code changes or deployments to your site are required. At a high level, the tracking flow begins when a user visits the site and performs one or more searches. These searches generate query identifiers that associate user actions with specific queries. As the user interacts with search results and shows interest in a product, additional signals such as clicks and cart events are captured. If the user completes a purchase, the flow concludes with a purchase signal. Each purchased product is linked to the query that led to its cart-add. This process enables end-to-end tracking of user behavior from search to purchase. In this scenario, the signals beacon uses several primary tracking mechanisms:
  • Visitor ID: A randomly generated identifier stored in local browser storage. It is unique to both the visitor and the device. It persists across sessions.
  • Session ID: A randomly generated identifier that the beacon uses to track and assign signals to sessions. It is stored in local browser storage under the lwBeaconSessionId key. It expires after 30 minutes of inactivity. This duration is configurable using sessionTimeoutThreshold. Each signal resets the inactivity timer, and the session ID persists across tabs and page reloads. When the user returns after the session expires, a new session ID is generated, but the visitor ID remains the same.
  • Query ID: A randomly generated identifier created when a search query is submitted. It is stored in session storage and is included with signal events related to that query, such as clicks and cart-adds.
  • Cart ID: A unique identifier created when a product is added to the cart. It’s shared by every cart-add signal and the purchase signal for that cart. Together with product IDs, it links each purchased product to the query that led to its cart-add. After a purchase, a new cart ID is generated to track subsequent transactions independently.
  • Beacon version: The version of the beacon script that sent the signal, in the beaconVersion field. Versioned scripts send the release number, such as 1.0.0. The legacy script sends latest+ followed by a build identifier. Lucidworks Support can use this field to identify the beacon version on your site.
The signal event flow below outlines a simplified sequence of common events. Additional signal types and behaviors are not included in this summary:
  1. When a user visits the site, a visitor ID and session ID are generated.
  2. When a query is submitted, a query ID is generated and a query signal is sent. This signal includes the visitor ID and session ID.
  3. For each new query, a new query ID is generated and another query signal is sent.
  4. When the user clicks on a product, a click signal is sent. This signal includes the associated query ID.
  5. When the user adds a product to their cart, a cart-add signal is sent with the current query ID and cart ID. If there’s no cart ID yet, one is generated.
  6. When the user completes a purchase and lands on the order confirmation page, a purchase signal is sent. This signal includes the order ID and the current cart ID. The purchase signal doesn’t include a query ID. Each purchased product is traced to its query through the cart ID and product ID. After the signal is sent, the cart ID is replaced with a new one to track future transactions independently.
See the following image for a visual representation of this flow:
Simplified signals beacon flow

How it works

The beacon sends signals to the: The following signals are collected:
  • Query signals. When a user performs a search, a signal is recorded.
  • Click signals. When a user clicks on a product, a signal is recorded. One example of a click signal is when a user clicks a search result, which is a strong indicator the result is relevant.
  • Cart-add signals. When a user clicks to add an item to the cart, a signal is recorded.
  • Purchase complete signals. When a user completes a purchase and is taken to the order confirmation page, a signal is recorded.
  • Facet usage. When a user applies a facet, a new query signal is recorded that includes the selected facets.
For information about how the signals beacon is related to other signals and analytics functions, see the Overview of signals process.

Prerequisites

You must be a workspace owner to configure the signals beacon. Before you begin, complete the following tasks:
  • Analyze your site to confirm compatibility with the signals beacon. The signals beacon is compatible with most websites, but you may need to adjust the configuration to ensure it works as needed.
    • Your site should use URL query parameters (?q=foo), not other methods of sending the query parameters. If it is not an option to use query parameters on your site, you can use the Signals API to send signals.
    • These fields should be surfaced in the page source, either as attributes or text nodes:
      • Product ID
      • Product title
      • Product image URL
      • Product price
      • Product URL
  • Identify any other fields that you want the signals beacon to capture. You’ll need their CSS paths to configure the beacon. Again, these can be either attributes or text nodes, as in these examples:
    A field’s path might be different on different pages of your site.
    The signals beacon supports multiple paths per field to accommodate this.
  • Create the Signals Store where the signals will be stored.

Enable the beacon

To install the beacon, navigate to the megamenu and click Signals.
  1. Click the Signals Store where you want to configure the signals beacon and then click Integrations.
  2. If the beacon has never been configured for this app, you’ll see “No embed token found” on the Signals Using Beacon screen. In that case, click the Generate button. It can take a few moments to generate the token.
  3. In the Allowed Origins field, enter the domains where you want to use the signals beacon. The format is <scheme>://<hostname>[:<port>]. For example, https://www.example.com.
  4. Set the Signals Beacon toggle to On.
  5. In the version dropdown above the script, choose Latest or a specific version. See Choose a beacon version. Then click Copy to copy the script and insert that script into the <head> tag of your website’s HTML file.
    This also enables the window.logBeaconInfo() function which you can use with your browser’s developer tools to inspect the fields captured by the beacon so that you can validate and refine your configuration.
    See Development and troubleshooting below.
  6. Edit the JSON configuration to process the signals you need for analytics. For more details, see:
  7. Click Apply. The configuration is applied to your website and it begins to send signals instantly based on that configuration.
    You can edit the configuration at any time. When you edit the JSON configuration and click Apply, the changes are applied in real time and signals are sent and processed using that configuration until it is modified.
    Each time you click Apply, Analytics Studio saves the configuration as a new version, so you can compare and restore earlier configurations. See View and restore configuration versions.
After the script is implemented and the signals are sent, you can access consolidated metrics. The Analytics Studio metrics provide valuable customer behavior insights, which can be used to improve your business.

Example JSON configuration

Use the following structure as an example to configure the beacon.
JSON configuration
  • Line 13. You can use multiple comma-separated paths in cases where a field has different paths on different pages of your site. See the Field path configuration section for details and examples.
  • Line 16. Everything below this line is your signal configuration, where you list the signals you want to track and the fields you want to extract from them.
  • Line 21. By default, these attributes inherit from the top-level attributes [productPath|fields].
  • Line 27. Turns off the purchase signal, which is sent when the user clicks a checkout element. Because an order can fail after that click, use purchase_complete instead.
  • Lines 30 and 31. Sends a purchase signal when the user lands on a page whose URL contains /order-confirmation. The order ID is read from the orderId URL query parameter.
  • Revenue. This example doesn’t set revenue, so the beacon calculates it from each product’s price and quantity. If you set purchase_complete.revenue, use the item subtotal, not the order total. Revenue shouldn’t include tax, shipping, or other fees.
For information about:
  • Attributes and fields used to extract product details from page elements, see the Field path configuration section.
  • The BeaconConfig interface, which includes detailed information about configuration properties, types, and default values, see Beacon configuration interface.

Example signals script

The following example contains possible fields and default values.
Signals script
  • Line 2. Global attributes inherited by each signal section.
  • Line 3. The CSS selector to target product elements. This is the global path inherited by each signal section if no custom path is provided at [query/click/cartAdd/purchase/purchase_complete].productPath. The default is .lw-product-item.
  • Line 4. The local storage key for the consumer page storing the cart UUID. The cartId value defaults to lwRetailCartId. The beacon obtains the value from localStorage.lwRetailCartId when attaching cart info to /retail/signals/cartadd and /retail/signals/purchase.
  • Line 5. This list specifies the fields treated as number type fields. The default is ["price", "quantity", "revenue"].
  • Line 7. This is the main section to extract product field value from your site. For more information, see the Field path configuration section in this topic, which provides detailed configuration about extracting product information to ensure accurate and consistent data collection.
  • Line 8. The productId field with a value of :scope @id is the only required field to use the Lucidworks Retail Beacon API.
  • Line 14. Specifies the URL parameter the beacon uses to monitor query updates. For example, with the default param query, if the current product page is filtered with the keyword hat, the URL parameter is http://example.com?query=hat. The default value is query.
  • Line 15. Specifies the delay, in milliseconds, for tracking element updates in the query. The default value is 1000.
  • Line 17. Custom overwrite of the fields configuration at the root level.
  • Line 34. The CSS selector that targets page elements for triggering add-to-cart actions. This has full CSS support for targeting multiple elements with comma-separated selectors. For example, button.add-to-bag, #AddToBagWithPrice.
  • Line 44. Turns off the purchase signal, which is sent when the user clicks a checkout element. Because an order can fail after that click, use purchase_complete to track completed purchases.
  • Line 47. The beacon sends a purchase signal when the current URL contains this substring. Use a stable part of your order confirmation page URL.
  • Line 48. The URL query parameter that contains the order ID. Alternatively, use orderIdSelector to read the order ID from a page element.
  • Line 49. The delay, in milliseconds, before the beacon reads the confirmation page. Increase this value if your site adds order details to the page after it loads. The default value is 1000.
  • Line 50. The CSS selector for the purchased items on the confirmation page. If your confirmation page doesn’t display purchased items, use a signal handler to add them.

Field path configuration

The signals beacon extracts product details from page elements using CSS selectors and attributes. You can capture any field that’s surfaced in the page’s DOM by adding it to your JSON configuration, under "fields". This section shows you how to configure your field paths, with examples. The format is: [Element CSS Selector] @[Value Attribute], as in the example below:

Special selectors

These special selectors and attributes are available:
  • The @text pseudo-attribute captures the inner text node, as in these examples:
  • The :scope CSS class targets product details defined on the root productPath element, as in this example:
  • The textContent selector targets elements by their text, as follows:
    • Exact match: [textContent='Add to cart!']
    • Contains: [textContent*='cart']
    • Starts with: [textContent^='add']
    • Ends with: [textContent$='cart!']
    For example:
  • You can also use data attributes as selectors, as in this example where data-testid is a data attribute:

Page type configuration

The pageTypes configuration enables you to classify queries by page type based on URL patterns. Configuration:
Type: { [pageType: string]: string[] } A mapping of page types to their corresponding URL patterns. The pageTypes configuration enables annotation of query signals via an optional pageType property. By default, when no pageType is specified, query signals are treated as originating from the search page. When a pageType is provided, its value is used for page-type matching. If a query does not match any configured patterns, its pageType is set to “OTHER”. Queries with a pageType other than null or “SEARCH” are excluded from the null query report. This is particularly useful for scenarios where queries originate from or redirect to non-search pages (e.g., category pages).
Explicitly configuring the “search” page type is recommended. Doing so ensures that any query signals from URLs that don’t match a configured pattern are classified as “OTHER” and excluded from the null query report.

Choose a beacon version

The beacon is available as a standalone script with its own version numbers. For each installation, choose one of these options:
  • Latest (recommended): The script updates automatically when Lucidworks releases a new version, so you get fixes and improvements without editing your site.
  • A specific version: The script never changes. Use this option if you need a stable feature set or a file that never changes.
To get the script, go to Analytics Studio > Integrations, choose an option in the version dropdown, and then copy the script. The dropdown selects Latest by default.
Script version dropdown above the beacon script on the Integrations page

Use a specific version

Latest moves to every new release without notice. If your site requires more control over changes to its behavior, you can use a specific version. A script for a specific version includes an integrity value, called a Subresource Integrity (SRI) hash. Your browser refuses to run the script if the file doesn’t match the hash, so the beacon code on your site can’t change without your approval.
  • Copy the integrity value from the script on the Integrations page, or find it for each release in https://storage.googleapis.com/sb-ui/beacon/v/versions.json.
  • Include crossorigin="anonymous". Without it, the browser can’t check the hash and blocks the script.
  • A script that uses Latest has no integrity value, because the file changes with each release.

How version numbers work

Each version number has the format MAJOR.MINOR.PATCH, such as 1.4.2:
  • Patch releases, such as 1.4.2 to 1.4.3, fix problems. Nothing changes on your site.
  • Minor releases, such as 1.4.3 to 1.5.0, add features that you can choose to use, such as a new configuration setting. Pages that don’t use the new feature see no change.
  • Major releases, such as 1.5.0 to 2.0.0, can include changes that break your site, such as removing or renaming a script attribute or configuration setting, or changing the signals the beacon sends.
During version 1, the existing script attributes and configuration settings don’t change. New attributes and settings can still be added in minor releases.

Move to a newer version

Lucidworks fixes problems only in the newest release. To receive a fix on a site that uses a specific version of the signals beacon, copy the script for a newer version and replace the script on your site. A specific version keeps working after newer versions are released, unless Lucidworks removes it for a security problem. Your beacon configuration isn’t tied to a version. Every beacon version reads the same configuration, and a version ignores settings it doesn’t support. For example, a setting added in version 1.3.0 has no effect on a site that uses version 1.2.0, and no warning appears. Release notes name the first version that supports each new setting.

Move from the legacy script

Before versioned scripts, the beacon and the Agent Studio components were combined in one script, springboard.esm.js. That script keeps working and keeps updating automatically, but versioned scripts are now recommended. To move a page from the legacy script to the versioned beacon, add the new beacon script and remove the legacy script in the same change. The beacon script doesn’t need a beacon attribute.
Don’t add the versioned beacon script to a page whose legacy script still has a beacon attribute. Two beacons run, and every signal sends twice.
If the page also embeds an Agent Studio agent, it needs the versioned components script as well. See Configure the beacon with Agent Studio. After you move a page, check that each action sends one signal, not two, and that each signal’s beaconVersion is the release number you chose.

View and restore configuration versions

Each time you click Publish on the Integrations page, Analytics Studio saves your beacon configuration as a new numbered version, along with the user who created the version and when. You can compare it with earlier versions and restore a previous configuration.

Compare and view version history

Below the script on the Integrations page, choose a previous version to compare side by side with the live configuration. The configuration versions table lists each version, which version is active, the changes from the previous version, who applied the change, and when.
Configuration versions table

Restore a version

You can restore a previous version from the comparison view or from the versions table. Click the Restore Version icon next to the date to restore that version. Restoring a version saves it as a new version. No versions are deleted, so you can always return to the configuration you replaced.

Configure the beacon with Agent Studio

To use the signals beacon on the same page as Agent Studio, configure the beacon script with additional attributes. Agent Studio uses the <lw-template> web component, which requires specific beacon configuration to work correctly. For embedding details, select your agent type in Configure and deploy an agent.

Configure the beacon for multiple pages of search results

You can configure the signals beacon if your site separates query results by tabs. For example, one tab for content and another tab for product information. In the following example, each tab’s content path is separated by a comma under "productPath" with the "fields" property defining what is tracked for each tab using :scope.
Configuration

Programmatic hooks

Signal handlers modify, enhance, or suppress signals before the beacon sends them. Use a handler when the data you need isn’t in the page’s Document Object Model (DOM) but is available elsewhere, such as facets stored outside the URL or order details stored in your site’s data layer. You can define a handler for each signal type: query, click, cartAdd, purchase, and purchase_complete. There are two ways to register a handler:
  • In the beacon configuration. Add a handler property to the signal section. The value is a function written as a string. The function receives an object with window and payload properties.
  • In your site’s code. Call window.addBeaconListener after the beacon loads. The callback receives the signal payload. You can register one handler for each signal type, and you only need to register it once.
If a signal type has a handler in both places, the handler in the beacon configuration is used.

Signal handler behavior

The signal handler can be used for the following:
  • Modify signals: return the modified payload object to send an enhanced signal.
  • Suppress signals: return false to prevent the signal from being sent.
  • Error handling: if a runtime error occurs in the callback function, the original unmodified signal will be sent.
If the signal handler returns undefined or null, the unmodified signal will be sent.
Signal handlers run synchronously and must return their result immediately. Don’t use async functions or return a Promise, because the beacon doesn’t wait for it to resolve.
The arguments to the window.addBeaconListener function should include these:
  1. The signal type.
  2. Callback function with one argument (signal payload).

Examples of signal payload enhancement

Enhancing a click payload:
Example of a query payload:

Example of conditional signal suppression

Example of a purchase complete signal from a data layer

Order confirmation pages often don’t display product details in a way the beacon can extract. If your site stores order details in a JavaScript data layer, use a purchase_complete handler to build the signal from that data. This example assumes your site pushes an event like the following to window.dataLayer when the confirmation page loads. Adjust the property names in the handler to match your site’s data layer.
Data layer event
Add the handler to the purchase_complete section of your beacon configuration, or register it in your site’s code:
When you build a purchase signal with a handler, keep the following in mind:
  • The signal must include products. The beacon doesn’t send a purchase signal with an empty productDetails list.
  • Product IDs must match your other signals. Use the same product ID format as your click and cart-add signals, including prefixes and leading zeros. If the formats differ, Analytics Studio can’t connect purchases to earlier signals, and conversion metrics are inaccurate. Normalize the IDs in the handler if needed.
  • Use the item subtotal for revenue. Order-level metrics, such as average order value and revenue per visit, use the revenue value. Exclude tax, shipping, and other fees so these metrics reflect the value of the purchased items. Product-level reports use each product’s price and quantity instead.
  • Allow time for the data layer. The beacon waits for delayForPurchaseRedirect milliseconds before it runs the handler. If your site adds order details to the data layer after the page loads, increase this value. A longer delay increases the chance that the user leaves the page before the signal is sent.

Content Security Policy (CSP) requirements

If your site uses a Content Security Policy (CSP), you must add the following directives to allow the signals beacon to load and send data:
  • script-src: Add https://storage.googleapis.com because the beacon script is served from Google Cloud Storage.
  • connect-src: Add the Signal Store API host and, if using Agent Studio, the App Studio API host.
The following example shows the minimum required CSP directives:
Replace SIGNAL_STORE_API_URL with the signals store API URL: the api-url attribute of a versioned beacon script, or the signal-store-api-url attribute of the legacy script. When using Agent Studio, replace APP_STUDIO_API_URL with the agent’s API URL: the api-url attribute of the versioned components script, or the app-studio-api-url attribute of the legacy script.

Development and troubleshooting

The signals beacon includes the built-in window.logBeaconInfo() debugging utility that logs verbose information if the debug flag is enabled. To enable the debug flag in your local storage, set localStorage.enableBeaconDev = true.