From 5020cb0410ad509308fe0f161eef330120c1fcd9 Mon Sep 17 00:00:00 2001 From: julitafalcondusza Date: Tue, 7 Jul 2026 14:43:43 +0200 Subject: [PATCH 1/5] websiteId section added --- .../recommendations_twig_functions.md | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/docs/templating/twig_function_reference/recommendations_twig_functions.md b/docs/templating/twig_function_reference/recommendations_twig_functions.md index 6dd1bdddf7..f8956b91bd 100644 --- a/docs/templating/twig_function_reference/recommendations_twig_functions.md +++ b/docs/templating/twig_function_reference/recommendations_twig_functions.md @@ -74,9 +74,71 @@ 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()` funtion. + +Example: + +``` html+twig +{{ ibexa_tracking_track_event('visit', product, { + websiteId: 'my-id' +}) }} +``` + +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` 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 following: + +``` php + Date: Wed, 8 Jul 2026 07:40:16 +0200 Subject: [PATCH 2/5] typos --- .../twig_function_reference/recommendations_twig_functions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/templating/twig_function_reference/recommendations_twig_functions.md b/docs/templating/twig_function_reference/recommendations_twig_functions.md index f8956b91bd..2e7d73a9e2 100644 --- a/docs/templating/twig_function_reference/recommendations_twig_functions.md +++ b/docs/templating/twig_function_reference/recommendations_twig_functions.md @@ -79,7 +79,7 @@ ibexa_tracking_track_event( ### `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()` funtion. +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: @@ -101,7 +101,7 @@ The value of `websiteId` parameter is resolved in the following order: If no value is resolved, the event is sent without the `p7` parameter. -To resolve `websiteId` on the project level, implement the interface as following: +To resolve `websiteId` on the project level, implement the interface as follows: ``` php Date: Wed, 8 Jul 2026 09:21:57 +0200 Subject: [PATCH 3/5] code language fixed --- .../twig_function_reference/recommendations_twig_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/templating/twig_function_reference/recommendations_twig_functions.md b/docs/templating/twig_function_reference/recommendations_twig_functions.md index 2e7d73a9e2..8eae2c20f8 100644 --- a/docs/templating/twig_function_reference/recommendations_twig_functions.md +++ b/docs/templating/twig_function_reference/recommendations_twig_functions.md @@ -133,7 +133,7 @@ Implementing the interface is sufficient, no service configuration is required. If you register multiple providers, control their order by tagging the service with a priority (higher priority is checked first): -``` php +``` yaml App\Tracking\MyWebsiteIdProvider: tags: - { name: ibexa.connector.raptor.tracking.website_id_context_provider, priority: 50 } From db77eda7d6173e461297e014b1a3a434bf807c04 Mon Sep 17 00:00:00 2001 From: julitafalcondusza Date: Wed, 8 Jul 2026 10:15:36 +0200 Subject: [PATCH 4/5] fixes, content added --- .../recommendations_twig_functions.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/templating/twig_function_reference/recommendations_twig_functions.md b/docs/templating/twig_function_reference/recommendations_twig_functions.md index 8eae2c20f8..faefa24fb2 100644 --- a/docs/templating/twig_function_reference/recommendations_twig_functions.md +++ b/docs/templating/twig_function_reference/recommendations_twig_functions.md @@ -114,22 +114,24 @@ use Ibexa\Contracts\ConnectorRaptor\Tracking\ContextProvider\WebsiteIdContextPro final class MyWebsiteIdProvider implements WebsiteIdContextProviderInterface { - public function getWebsiteId(): ?string + private const string WEBSITE_ID = 'my-id'; + + public function getWebsiteId(): string { - // Return a non-empty string to use it as the websiteId (p7), - // or null to defer to the next provider in the chain. - return 'my-id'; + return self::WEBSITE_ID; } } ``` +Since this provider always returns a value, it narrows the return type to `string`. +If your provider resolves the value conditionally, declare the return type as `?string` and return `null` to allow the next provider in the chain to handle the request. The provider is registered automatically. Implementing the interface is sufficient, no service configuration is required. !!! note Custom provider takes precedence over the built-in one. - A provider must return either null or a non-empty string. + A provider must return either `null` or a non-empty string. If you register multiple providers, control their order by tagging the service with a priority (higher priority is checked first): From da23414f88d73b4edd7f9fe4506c55c079eb097a Mon Sep 17 00:00:00 2001 From: julitafalcondusza Date: Fri, 10 Jul 2026 13:21:23 +0200 Subject: [PATCH 5/5] fixes after rev --- .../recommendations_twig_functions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/templating/twig_function_reference/recommendations_twig_functions.md b/docs/templating/twig_function_reference/recommendations_twig_functions.md index faefa24fb2..35a36c7030 100644 --- a/docs/templating/twig_function_reference/recommendations_twig_functions.md +++ b/docs/templating/twig_function_reference/recommendations_twig_functions.md @@ -85,7 +85,7 @@ Example: ``` html+twig {{ ibexa_tracking_track_event('visit', product, { - websiteId: 'my-id' + websiteId: 'ibexa_user_get_current().login' }) }} ``` @@ -96,7 +96,7 @@ 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` implementations (the first one returning a non-null value wins). +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. @@ -114,7 +114,7 @@ use Ibexa\Contracts\ConnectorRaptor\Tracking\ContextProvider\WebsiteIdContextPro final class MyWebsiteIdProvider implements WebsiteIdContextProviderInterface { - private const string WEBSITE_ID = 'my-id'; + private const string WEBSITE_ID = 'ibexa_user_get_current().login'; public function getWebsiteId(): string {