BeaconConfig interface, including related interfaces, types, and default values.
For more information about the script to paste into the <head> tag of your website’s HTML file and the JSON configuration, see Signals Beacon.
BeaconConfig
This object details the primary configuration interface for the signals beacon. The signal sectionsquery, click, cartAdd, purchase, and purchase_complete are top-level keys, at the same level as attributes and fields.
The signal type.
Valid values are
RETAIL and SITE_SEARCH.
SITE_SEARCH is a legacy type that only supports query and click signals.The global configuration inherited by each signal section.
See BeaconAttributes.
Static values attached as-is to every signal.
Supported keys are
componentId, initialCompositionId, and compositionId.
Unlike attributes, these values don’t tell the beacon how to find data on the page.The main section for extracting product field values from your site.
Each signal section inherits these fields unless it defines its own.
Use the field names
productId, title, price, uri, and imageuri.
The beacon doesn’t rename fields, so other names such as id, image, or url aren’t recognized.The configuration for query signals.
See BeaconQueryProps.
The configuration for signals sent when a product is clicked.
See BeaconClickProps.
The configuration for signals sent when a product is added to the shopping cart or bag.
See BeaconCartAddProps.
The configuration for purchase signals sent when the user clicks a checkout element, such as a Place order button.
This represents a purchase attempt, not a completed purchase.
See BeaconPurchaseProps.
The configuration for purchase signals sent when the user lands on the order confirmation page.
This represents a completed purchase and is the recommended way to track purchases.
See BeaconPurchaseCompleteProps.
The configuration for site visit signals.
Visit signals are off unless you set
enabled to true.BeaconFieldConfig
This is a type alias for field configuration. The value can be a string, or aBeaconFieldRichConfig object.
BeaconFieldRichConfig
This object details the interface to fine tune field details.This string is excluded from the raw value.
For example, with
"exclude": "Sale Price: ", the raw value Sale Price: 100 is extracted as 100.
If the value is a /regex/ pattern, the field value is the pattern’s first capture group.This property provides additional typing information that allows for proper transformation of the value.
Set to
number to parse the value as a number, even if the field isn’t listed in numberTypeFields.Treats the raw value as a URL and extracts the value of this query parameter.
For example, with
"path": ":scope a.product-link @href" and "queryParamFromUrl": "uid", the link http://example.com?uid=123 is extracted as 123.BeaconAttributes
This object details the interface for the global configuration inherited by each signal section.The local storage key for the consumer page storing the cart UUID.
The beacon replaces the cart ID after a purchase signal is sent.
The CSS selector for targeting product elements. This is the global path inherited by each signal section.
Optional inactivity threshold in milliseconds that ends a session and starts a new one. The default is 1800000 ms (30 minutes).
This specifies the fields that are treated as number type fields.
The interval, in milliseconds, for sending signals in batches.
When set, signals are queued in local storage and sent on this interval instead of immediately.
The default value
0 disables batching.BeaconSignalProps
This object details the interface that provides common properties for all signal sections.BeaconQueryProps, BeaconClickProps, BeaconCartAddProps, BeaconPurchaseProps, and BeaconPurchaseCompleteProps all include these properties.
The custom selector to target product elements for this signal section.
If not set, the value of
attributes.productPath is used.The fields to extract for this signal section.
Fields defined here override the matching top-level fields.
Fields not defined here fall back to the top-level
fields.A function, written as a string, that modifies or suppresses the signal before it is sent.
The function receives an object with
window and payload.
Return the modified payload to send it, or return false to suppress the signal.
If the function returns undefined or null, or throws an error, the original signal is sent.
A handler in the configuration takes precedence over a handler registered with window.addBeaconListener.
For details and examples, see Programmatic hooks.BeaconQueryProps
This object details the interface for configuring beacon signals sent during a product search.The URL query parameter the beacon uses to monitor query updates.
If you provide a list, the parameters are checked in order and the first one with a value is used.
The CSS selector for targeting multiple page elements related to product query activities. The beacon analyzes the comma-separated elements, monitors when the ‘Enter’ key is pressed on the input element as well as clicks on the remaining elements, then sends query signals accordingly.In addition, the beacon supports the ability to track the ‘Enter’ key along with clicks on the search button for scenarios where there is no query parameter if the
trigger property is used. For example, the main search flow could use the query parameter q while the search within the search uses the beacon properties to record both the input and the search button clicks. An example configuration is:This specifies the delay, in milliseconds, for tracking element updates in the query.
A substring or
/regex/ pattern.
When set, a query signal is sent on pages whose URL matches this pattern.Restricts query tracking to URLs that contain one of these substrings.
If empty or not set, query tracking is allowed on all URLs.
Maps a category page URL pattern to a search term.
Use this for category pages that don’t have a query parameter.
Maps page types to URL patterns, which can be substrings or
/regex/ patterns.
See Page type configuration.BeaconClickProps
This object details the interface for configuring beacon signals when the user clicks a product. It includes the properties in BeaconSignalProps.BeaconCartAddProps
This object details the interface for configuring beacon signals sent when a product is added to the shopping cart or bag. It includes the properties in BeaconSignalProps.BeaconPurchaseProps
This object details the interface for configuring purchase signals sent when the user clicks a checkout element, such as a Place order button. It includes the properties in BeaconSignalProps. Because the order can still fail after the click, this signal represents a purchase attempt. To track completed purchases, configurepurchase_complete and set purchase.enabled to false.
Both sections send signals to the same purchase endpoint, so enabling both can record the same order twice.
The CSS selector for targeting page elements that trigger purchase signals.
Separate multiple selectors with commas.
The path to the element that displays the item subtotal for the cart.
Revenue should include only the price of the purchased products.
Use the
subtotal element as the revenue value if the order total includes tax, shipping, or other fees.
If not set, revenue is calculated from the price and quantity of each product.BeaconPurchaseCompleteProps
This object details the interface for configuring purchase signals sent when the user lands on the order confirmation page. It includes the properties in BeaconSignalProps. This is the recommended way to track purchases. The signal includes an order ID, which identifies a completed purchase.A substring of the order confirmation page URL, such as
/order-confirmation.
When the current URL contains this value, the beacon sends a purchase signal.
This value is always matched as a literal substring; /regex/ patterns aren’t supported.The URL query parameter that contains the order ID.
If both
orderIdUrlParam and orderIdSelector are set, orderIdUrlParam is used.The path to the element that displays the item subtotal for the order.
Revenue should include only the price of the purchased products.
Use the
subtotal element as the revenue value if the order total includes tax, shipping, or other fees.
If not set, revenue is calculated from the price and quantity of each product.The delay, in milliseconds, after the confirmation page loads before the beacon reads the page and sends the signal.
Increase this value if your site adds order data to the page after it loads.
If the delay is too short, the data might not be available yet.
If the delay is too long, the user might leave the page before the signal is sent.
handler to add them to the signal from another source, such as your site’s data layer.
For an example, see Example of a purchase complete signal from a data layer.
Revenue should include only the price of the purchased products.
Exclude tax, shipping, and other fees.
Order-level metrics in Analytics Studio, such as average order value and revenue per visitor, are calculated from this value.
If you’re not sure which element on your confirmation page shows the item subtotal, leave
revenue unset so the beacon calculates it from product prices and quantities.