Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions code_samples/recommendations/events/category_parameter.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% block content %}
<div class="product-details">
<h1>{{ product.name }}</h1>
{# ... product content ... #}
</div>

{# Track with category identifier - automatic loading and formatting #}
{{ ibexa_tracking_track_event('visit', product, {
'categoryIdentifier': 'electronics'
}) }}
{% endblock %}
29 changes: 27 additions & 2 deletions docs/recommendations/raptor_integration/tracking_php_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Advanced usage – direct interaction with the service

The [`ServerSideTrackingDispatcherInterface::dispatch()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorRaptor-Tracking-ServerSideTrackingDispatcherInterface.html#method_dispatch) method allows to send tracking data from the server side.
The [`ServerSideTrackingDispatcherInterface::dispatch()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorRaptor-Tracking-ServerSideTrackingDispatcherInterface.html#method_dispatch) method allows sending tracking data from the server side.
It can be used in controllers, event subscribers, or any other part of the application.
This method receives an [`EventDataInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorRaptor-Tracking-Event-EventDataInterface.html).
For more information, see the available events in the [tracking event namespace](/api/php_api/php_api_reference/namespaces/ibexa-contracts-connectorraptor-tracking-event.html).
Expand Down Expand Up @@ -37,9 +37,34 @@
[[= include_file('code_samples/recommendations/EventMapper.php', 20, 27, remove_indent=True) =]]
```

### Category parameter for product events

In [[= product_name =]], products can be assigned to multiple categories.

Check notice on line 42 in docs/recommendations/raptor_integration/tracking_php_api.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/recommendations/raptor_integration/tracking_php_api.md#L42

[Ibexa.Passive] Try to avoid passive tense, when possible.
Raw output
{"message": "[Ibexa.Passive] Try to avoid passive tense, when possible.", "location": {"path": "docs/recommendations/raptor_integration/tracking_php_api.md", "range": {"start": {"line": 42, "column": 39}}}, "severity": "INFO"}
However, Raptor accepts only a single category value in tracking events.

By default, the connector uses the first category from the list of categories assigned to the product.
You can override this behavior and define which category is sent in tracking events.

Check notice on line 46 in docs/recommendations/raptor_integration/tracking_php_api.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/recommendations/raptor_integration/tracking_php_api.md#L46

[Ibexa.Passive] Try to avoid passive tense, when possible.
Raw output
{"message": "[Ibexa.Passive] Try to avoid passive tense, when possible.", "location": {"path": "docs/recommendations/raptor_integration/tracking_php_api.md", "range": {"start": {"line": 46, "column": 58}}}, "severity": "INFO"}

To do this:

1. Open the product page in the back office.
2. Check the categories assigned to the product and select the one you want to use.
3. Copy the identifier.
4. Pass this identifier as the category parameter in the tracking event.

!!! note

This option applies only to product-related tracking events.

Example:

``` twig+html
[[= include_file('code_samples/recommendations/events/category_parameter.html.twig') =]]
```

### Manual `EventData` creation

Manual creation of EventData allows precise control over the events sent to the service.
Manual creation of `EventData` allows precise control over the events sent to the service.
It enables you to define custom event parameters, track specific user interactions, and tailor data collection to advanced use cases.

Check the following example:
Expand Down
Loading