From ee88b9421455ff5ded10085a9bde391ff62bc34f Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Mon, 13 Apr 2026 10:30:28 +0200 Subject: [PATCH 1/6] EventMapper.php: Format --- code_samples/recommendations/EventMapper.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code_samples/recommendations/EventMapper.php b/code_samples/recommendations/EventMapper.php index b89ec50fc4..0716954234 100644 --- a/code_samples/recommendations/EventMapper.php +++ b/code_samples/recommendations/EventMapper.php @@ -1,4 +1,7 @@ Date: Mon, 13 Apr 2026 10:31:17 +0200 Subject: [PATCH 2/6] EventData.php: Wrap into a class Should fix PhpStan errors "Variable $product might not be defined." --- code_samples/recommendations/EventData.php | 31 ++++++++++++++----- .../raptor_integration/tracking_php_api.md | 4 ++- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/code_samples/recommendations/EventData.php b/code_samples/recommendations/EventData.php index aa50de626c..5ea0fce894 100644 --- a/code_samples/recommendations/EventData.php +++ b/code_samples/recommendations/EventData.php @@ -1,12 +1,27 @@ getCode(), - productName: $product->getName(), - categoryPath: '25#Electronics;26#Smartphones', // Build manually - currency: 'USD', - itemPrice: '999.99' -); + public function dispatchVisitEvent(ProductInterface $product): void + { + $eventData = new VisitEventData( + productCode: $product->getCode(), + productName: $product->getName(), + categoryPath: '25#Electronics;26#Smartphones', // Build manually + currency: 'USD', + itemPrice: '999.99' + ); -$this->trackingDispatcher->dispatch($eventData); + $this->trackingDispatcher->dispatch($eventData); + } +} diff --git a/docs/recommendations/raptor_integration/tracking_php_api.md b/docs/recommendations/raptor_integration/tracking_php_api.md index 7a07cefcf0..2f93cfac48 100644 --- a/docs/recommendations/raptor_integration/tracking_php_api.md +++ b/docs/recommendations/raptor_integration/tracking_php_api.md @@ -28,7 +28,9 @@ It enables you to define custom event parameters, track specific user interactio Check the following example: ``` php -[[= include_file('code_samples/recommendations/EventData.php') =]] +[[= include_file('code_samples/recommendations/EventData.php', 4, 6) =]]// … + +[[= include_file('code_samples/recommendations/EventData.php', 16, 25, remove_indent=True) =]] ``` `categoryPath` parameter sets the category path for recommendations and needs to be composed manually following the specified format and rules: From 1413a1674344f68ab0ab8d6dd705149b0f0268fe Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Mon, 13 Apr 2026 10:35:52 +0200 Subject: [PATCH 3/6] EventData.php: ProductInterface; Should fix PhpStan error "invalid type App\Tracking\ProductInterface" --- code_samples/recommendations/EventData.php | 1 + 1 file changed, 1 insertion(+) diff --git a/code_samples/recommendations/EventData.php b/code_samples/recommendations/EventData.php index 5ea0fce894..622d1a8a12 100644 --- a/code_samples/recommendations/EventData.php +++ b/code_samples/recommendations/EventData.php @@ -4,6 +4,7 @@ use Ibexa\Contracts\ConnectorRaptor\Tracking\Event\VisitEventData; use Ibexa\Contracts\ConnectorRaptor\Tracking\ServerSideTrackingDispatcherInterface; +use Ibexa\Contracts\ProductCatalog\Values\ProductInterface; class TrackingEventDispatchingExample { From 975a1e725acc40b6300a0759616770705e8c937d Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Mon, 13 Apr 2026 10:39:41 +0200 Subject: [PATCH 4/6] Event*.php: Format --- code_samples/recommendations/EventMapper.php | 2 +- code_samples/recommendations/EventSubscriber.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code_samples/recommendations/EventMapper.php b/code_samples/recommendations/EventMapper.php index 0716954234..df39c9da5e 100644 --- a/code_samples/recommendations/EventMapper.php +++ b/code_samples/recommendations/EventMapper.php @@ -11,7 +11,7 @@ class EventMapper { public function __construct( private readonly EventMapperInterface $eventMapper, - private ServerSideTrackingDispatcherInterface $trackingDispatcher, + private readonly ServerSideTrackingDispatcherInterface $trackingDispatcher, ) { } diff --git a/code_samples/recommendations/EventSubscriber.php b/code_samples/recommendations/EventSubscriber.php index 3144d4fd84..175784efc4 100644 --- a/code_samples/recommendations/EventSubscriber.php +++ b/code_samples/recommendations/EventSubscriber.php @@ -1,4 +1,7 @@ Date: Mon, 13 Apr 2026 10:43:00 +0200 Subject: [PATCH 5/6] Event*.php: Format --- code_samples/recommendations/EventData.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code_samples/recommendations/EventData.php b/code_samples/recommendations/EventData.php index 622d1a8a12..4825ed6114 100644 --- a/code_samples/recommendations/EventData.php +++ b/code_samples/recommendations/EventData.php @@ -6,10 +6,10 @@ use Ibexa\Contracts\ConnectorRaptor\Tracking\ServerSideTrackingDispatcherInterface; use Ibexa\Contracts\ProductCatalog\Values\ProductInterface; -class TrackingEventDispatchingExample +class EventData { public function __construct( - private ServerSideTrackingDispatcherInterface $trackingDispatcher, + private readonly ServerSideTrackingDispatcherInterface $trackingDispatcher, ) { } From 670c9476e61a0c2a4e8af0d9cb75bc963566a1e3 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Mon, 13 Apr 2026 10:58:48 +0200 Subject: [PATCH 6/6] tracking_php_api.md: Fix include_file --- docs/recommendations/raptor_integration/tracking_php_api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/recommendations/raptor_integration/tracking_php_api.md b/docs/recommendations/raptor_integration/tracking_php_api.md index 2f93cfac48..5bdc261705 100644 --- a/docs/recommendations/raptor_integration/tracking_php_api.md +++ b/docs/recommendations/raptor_integration/tracking_php_api.md @@ -30,7 +30,7 @@ Check the following example: ``` php [[= include_file('code_samples/recommendations/EventData.php', 4, 6) =]]// … -[[= include_file('code_samples/recommendations/EventData.php', 16, 25, remove_indent=True) =]] +[[= include_file('code_samples/recommendations/EventData.php', 17, 26, remove_indent=True) =]] ``` `categoryPath` parameter sets the category path for recommendations and needs to be composed manually following the specified format and rules: