diff --git a/docs/templating/twig_function_reference/recommendations_twig_functions.md b/docs/templating/twig_function_reference/recommendations_twig_functions.md index 6dd1bdddf7..35a36c7030 100644 --- a/docs/templating/twig_function_reference/recommendations_twig_functions.md +++ b/docs/templating/twig_function_reference/recommendations_twig_functions.md @@ -74,9 +74,73 @@ ibexa_tracking_track_event( - **eventType** - type: string, defines the type of tracking event to be sent, for example, `visit`, `contentvisit`, `buy`, `basket`, `itemclick`. For more information, see [Tracking events for recommendations](https://content.raptorservices.com/help-center/tracking-events-parameters-reference). - **data** (optional) - type: mixed, accepts the primary object associated with the event, such as a Product or Content, can be null if not required. For more information, see [tracking event examples](#tracking-events). -- **context** (optional)- type: array, additional event data, such as quantity, basket details, or custom parameters. For more information, see [example usage](#context-parameter-example-usage). +- **context** (optional)- type: array, additional event data, such as quantity, basket details, [website ID](#websiteid-parameter), or custom parameters. For more information, see [example usage](#context-parameter-example-usage). - **template** (optional) - type: string, path to a custom Twig template used to render the tracking event, allows overriding the default tracking output. +### `websiteId` parameter + +The `websiteId` (`p7`) parameter for [Raptor tracking](https://content.raptorservices.com/help-center/introduction-to-tracking-documentation) can be optionally provided as a **context** to `ibexa_tracking_track_event()` function. + +Example: + +``` html+twig +{{ ibexa_tracking_track_event('visit', product, { + websiteId: 'ibexa_user_get_current().login' +}) }} +``` + +The website ID, also known as a **Login ID**, is available for logged-in users. +It serves as a persistent, cross-device identifier. +Both the User ID and the Cookie ID can be used to personalize website modules. + +The value of `websiteId` parameter is resolved in the following order: + +1. Explicit `websiteId` passed in the `ibexa_tracking_track_event()` context. +2. Custom [`WebsiteIdContextProviderInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorRaptor-Tracking-ContextProvider-WebsiteIdContextProviderInterface.html) implementations (the first one returning a non-null value wins). +3. The built-in provider, which uses the logged-in user's identifier (`ruid`). + +If no value is resolved, the event is sent without the `p7` parameter. + +To resolve `websiteId` on the project level, implement the interface as follows: + +``` php +