Tracking with JS
Send FactFinder tracking events through the Web Components JavaScript API.
Instead of using the built-in tracking, you are also able to use WebComponents' JavaScript API to send your tracking events.
The Tracking namespace contains the relevant tracking methods. All contained methods take one object as a parameter.
You can access it like this:
const track = factfinder.communication.Tracking;Retrieving necessary information
Some information is provided by FactFinder Web Components and/or FactFinder.
sid
You can retrieve the current FactFinder Web Components sid by calling this helper function:
factfinder.common.localStorage.getItem("ff_sid");id
The id parameter has to match the field value of the field configured as trackingProductNumber field role.
masterId
The masterId parameter has to match the field value of the field configured as masterArticleNumber field role.
channel
The channel parameter is a property of the <ff-communication> element. You can access it like this:
or using the global JS property factfinder.communication.globalSearchParameter.channel.
For more explanation please refer to the FactFinder Tracking Documentation.
Tracking Examples
You can use the tracking object like this:
Retrieve product information via FactFinder Web Components
If you can't access the necessary field using your shop-system's API, you can query FactFinder for product information.
You can, however, also access the fields of record directly. If you do so, be aware that the price fields from your data feed may have been localized according to your currency settings. Once they are localized strings, they cannot be used for tracking requests anymore because these requests require numeric price values.
Web Components preserves these unmodified price values in separate properties which are added to record. For example, a price field named Price would be localized and its original numeric value would be stored in a new property __ORIG_PRICE__.
The names of the additional properties are generated from the original field name. The original value of a field named Old_Price would be stored in __ORIG_OLD_PRICE__.
The following will likely result in an error because Old_Price may have been modified into a localized string:
The original numeric value that can be used for tracking can be accessed directly like this:
Last updated
Was this helpful?