Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3583d90
first batch added
julitafalcondusza Apr 3, 2026
6be8b25
content added
julitafalcondusza Apr 3, 2026
0e888f8
recommendations twig page added
julitafalcondusza Apr 3, 2026
f99ef95
updates
julitafalcondusza Apr 3, 2026
2e6f571
content moved, structure updated
julitafalcondusza Apr 3, 2026
9307035
guide added
julitafalcondusza Apr 7, 2026
0930200
guide content
julitafalcondusza Apr 7, 2026
5c30896
fixes, content moved
julitafalcondusza Apr 7, 2026
ae73918
fixes after review
julitafalcondusza Apr 7, 2026
5fab98d
Raptor integration - feature branch: fix links (#3123)
adriendupuis Apr 8, 2026
0493195
new batch of fixes
julitafalcondusza Apr 8, 2026
701594d
updates
julitafalcondusza Apr 8, 2026
6aa1709
new blocks added
julitafalcondusza Apr 9, 2026
3fe76fa
name fix
julitafalcondusza Apr 9, 2026
4a4de00
fix
julitafalcondusza Apr 9, 2026
3c252cb
new page added to cards on raptor_connector landing page
julitafalcondusza Apr 9, 2026
916b1b3
fixes - first batch
julitafalcondusza Apr 10, 2026
42f564e
new fixes
julitafalcondusza Apr 10, 2026
9417292
PHP & JS CS Fixes
julitafalcondusza Apr 10, 2026
745d3ff
new fixes
julitafalcondusza Apr 10, 2026
1f7bb23
block names fixed
julitafalcondusza Apr 10, 2026
5d231e3
code fixed
julitafalcondusza Apr 10, 2026
28025cc
code fixed
julitafalcondusza Apr 10, 2026
fba3463
links fixed
julitafalcondusza Apr 10, 2026
1f400e1
card fixed
julitafalcondusza Apr 10, 2026
3ca94b5
IBX-11571: Rendering recommendations outside of Page Builder document…
julitafalcondusza Apr 10, 2026
771e1e0
php fix
julitafalcondusza Apr 10, 2026
e44ed16
composer.json fix - connector-raptor added
julitafalcondusza Apr 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions code_samples/recommendations/EventData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
use Ibexa\Contracts\ConnectorRaptor\Tracking\Event\VisitEventData;

$eventData = new VisitEventData(
productCode: $product->getCode(),

Check failure on line 5 in code_samples/recommendations/EventData.php

View workflow job for this annotation

GitHub Actions / Validate code samples (8.3)

Variable $product might not be defined.

Check failure on line 5 in code_samples/recommendations/EventData.php

View workflow job for this annotation

GitHub Actions / Validate code samples (8.4)

Variable $product might not be defined.
productName: $product->getName(),

Check failure on line 6 in code_samples/recommendations/EventData.php

View workflow job for this annotation

GitHub Actions / Validate code samples (8.3)

Variable $product might not be defined.

Check failure on line 6 in code_samples/recommendations/EventData.php

View workflow job for this annotation

GitHub Actions / Validate code samples (8.4)

Variable $product might not be defined.
categoryPath: '25#Electronics;26#Smartphones', // Build manually
currency: 'USD',
itemPrice: '999.99'
);

$this->trackingDispatcher->dispatch($eventData);

Check failure on line 12 in code_samples/recommendations/EventData.php

View workflow job for this annotation

GitHub Actions / Validate code samples (8.3)

Variable $this might not be defined.

Check failure on line 12 in code_samples/recommendations/EventData.php

View workflow job for this annotation

GitHub Actions / Validate code samples (8.4)

Variable $this might not be defined.
23 changes: 23 additions & 0 deletions code_samples/recommendations/EventMapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php declare(strict_types=1);
use Ibexa\Contracts\ConnectorRaptor\Tracking\EventMapperInterface;
use Ibexa\Contracts\ConnectorRaptor\Tracking\EventType;
use Ibexa\Contracts\ConnectorRaptor\Tracking\ServerSideTrackingDispatcherInterface;
use Ibexa\Contracts\ProductCatalog\Values\ProductInterface;

class EventMapper
{
public function __construct(
private readonly EventMapperInterface $eventMapper,
private ServerSideTrackingDispatcherInterface $trackingDispatcher,
) {
}

public function trackProductView(ProductInterface $product, string $url): void
{
// Map product to VisitEventData automatically
$eventData = $this->eventMapper->map(EventType::VISIT, $product);

// Send tracking event
$this->trackingDispatcher->dispatch($eventData);
}
}
39 changes: 39 additions & 0 deletions code_samples/recommendations/EventSubscriber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php declare(strict_types=1);
use Ibexa\Contracts\ConnectorRaptor\Tracking\EventMapperInterface;
use Ibexa\Contracts\ConnectorRaptor\Tracking\EventType;
use Ibexa\Contracts\ConnectorRaptor\Tracking\ServerSideTrackingDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

class EventSubscriber implements EventSubscriberInterface
{
public function __construct(
private readonly EventMapperInterface $eventMapper,
private ServerSideTrackingDispatcherInterface $trackingDispatcher,
) {
}

public static function getSubscribedEvents(): array
{
return [KernelEvents::RESPONSE => ['onResponse', -10]];
}

public function onResponse(ResponseEvent $event): void
{
if (!$event->isMainRequest()) {
return;
}

$request = $event->getRequest();

// Example: track only if request has specific attribute
$product = $request->attributes->get('product');
if (null === $product) {
return;
}

$eventData = $this->eventMapper->map(EventType::VISIT, $product);
$this->trackingDispatcher->dispatch($eventData);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ibexa:
system:
<scope>:
connector_raptor:
enabled: true
customer_id: ~ # Required
tracking_type: client # One of: "client" or "server"

# Raptor Recommendations API key
recommendations_api_key: ~ # Required

# Raptor Recommendations API URL, optional, set by default
recommendations_api_url: '%ibexa.connector.raptor.recommendations.api_url%'
ibexa_connector_raptor:
# When enabled, tracking exceptions are thrown instead of being silently handled
strict_exceptions: true
31 changes: 31 additions & 0 deletions code_samples/recommendations/custom_integration.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
``` html
<!-- Cookie Consent by TermsFeed https://www.TermsFeed.com -->
<script type="text/javascript" src="https://www.termsfeed.com/public/cookie-consent/4.2.0/cookie-consent.js" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8">
document.addEventListener('DOMContentLoaded', function () {
cookieconsent.run({
"notice_banner_type": "simple",
"consent_type": "implied",
"palette": "dark",
"language": "en",
"page_load_consent_levels": ["strictly-necessary"],
"notice_banner_reject_button_hide": false,
"preferences_center_close_button_hide": false,
"page_refresh_confirmation_buttons": false,
"website_name": "Ibexa Storefront",
"callbacks": {
"scripts_specific_loaded": (level) => {
switch(level) {

Check warning on line 18 in code_samples/recommendations/custom_integration.html

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this "switch" statement by "if" statements to increase readability.

See more on https://sonarcloud.io/project/issues?id=ezsystems_developer-documentation&issues=AZ1TbtU5NywzTGnSeniM&open=AZ1TbtU5NywzTGnSeniM&pullRequest=3121
case 'tracking':
document.dispatchEvent(new CustomEvent('enableTracking'));
break;
}
}
},
"callbacks_force": true
});
});
</script>
<noscript>Free cookie consent management tool by <a href="https://www.termsfeed.com/">TermsFeed</a></noscript>
<!-- End Cookie Consent by TermsFeed https://www.TermsFeed.com -->
```
25 changes: 25 additions & 0 deletions code_samples/recommendations/events/basket_event.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{# templates/cart/add_confirmation.html.twig #}
{% extends 'base.html.twig' %}

{% block content %}
<div class="cart-notification">
<p>Product "{{ product.name }}" has been added to your cart!</p>
<p>Quantity: {{ addedQuantity }}</p>
</div>

{# Build basket content string: "product-code:quantity;product-code:quantity" #}
{% set basketContent = [] %}
{% for entry in cart.entries %}
{% set basketContent = basketContent|merge([entry.product.code ~ ':' ~ entry.quantity]) %}
{% endfor %}
{# Track basket addition #}
{% set basketContext = {
'basketContent': basketContent|join(';'),
'basketId': cart.id,
'quantity': addedQuantity
} %}

{{ ibexa_tracking_track_event('basket', product, basketContext) }}

<a href="{{ path('cart_view') }}">View Cart</a>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{# templates/bundles/IbexaCoreBundle/default/content/full.html.twig #}
{% extends '@!IbexaCore/default/content/full.html.twig' %}

{% block content %}
{{ parent() }}
{{ ibexa_tracking_track_event('contentvisit', content) }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{ ibexa_tracking_track_event('itemclick', product.code, {
'moduleName': 'homepage-recommendations',
'redirectUrl': path('ibexa.product.view', {'productCode': product.code})
}) }}
13 changes: 13 additions & 0 deletions code_samples/recommendations/events/product_visit_event.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# templates/product/view.html.twig #}
{% extends 'base.html.twig' %}

{% block content %}
<div class="product-details">
<h1>{{ product.name }}</h1>
<p>{{ product.description }}</p>
<div class="price">{{ product.price }}</div>
</div>

{# Track product visit #}
{{ ibexa_tracking_track_event('visit', product) }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% extends '@IbexaConnectorRaptor/themes/standard/ibexa/tracking/script.html.twig' %}
{% block ibexa_tracking_script %}
console.log('My custom tracking script, but relying on loadTracking function.');
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script type="text/javascript">
if (myCustomConsentIsGiven) {
{{ include('@ibexadesign/ibexa/tracking/script.js.twig', {'customer_id': customer_id}) }}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{# templates/pagelayout.html.twig #}
<!DOCTYPE html>
<html>
<head>
{# ... other head content ... #}

{# Initialize Raptor tracking - must be called before any tracking events #}
{{ ibexa_tracking_script() }}
</head>
<body>
{# ... page content ... #}
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{ ibexa_tracking_track_event(
'visit',
product,
{},
'@App/tracking/custom_visit.html.twig'
) }}
```

{# templates/tracking/custom_visit.html.twig #}

{#
# Custom visit tracking template
#
# Available variables:
# - parameters: array of Raptor tracking parameters (p1, p2, p3, etc.)
# - debug: boolean flag to enable debug console messages
#}

<script type="text/javascript">
{% autoescape 'js' %}
(function () {
// Custom logic before tracking
console.log('Custom visit tracking template');
console.log('Tracking parameters:', {{ parameters|json_encode|raw }});

// Send the tracking event (REQUIRED for tracking to work)
const event = 'trackEvent';
const params = {{ parameters|json_encode|raw }};
window.raptor.push(event, params);

// Custom logic after tracking
{% if debug %}
console.log('Visit event tracked successfully');
{% endif %}
})();
{% endautoescape %}
</script>
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"ibexa/phpstan": "~5.0.-dev",
"deptrac/deptrac": "^3.0",
"ibexa/cdp": "~5.0.x-dev",
"ibexa/connector-raptor": "~5.0.x-dev",
"ibexa/image-editor": "~5.0.x-dev"
},
"scripts": {
Expand Down
Loading
Loading