You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/templating/twig_function_reference/recommendations_twig_functions.md
+83-1Lines changed: 83 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,9 +74,91 @@ ibexa_tracking_track_event(
74
74
75
75
-**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).
76
76
-**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).
77
-
-**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).
77
+
-**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).
78
78
-**template** (optional) - type: string, path to a custom Twig template used to render the tracking event, allows overriding the default tracking output.
79
79
80
+
### `websiteId` parameter
81
+
82
+
The `websiteId`, also known as a **Login ID**, (`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.
83
+
84
+
When storing customer data in an external Customer Relationship Management (CRM) system, set the `websiteId` to an identifier of the customer stored there.
85
+
86
+
The following example shows how you pass that value, assuming a custom Twig function `get_custom_crm_identifier` integrating with that CRM exists:
Set the `websiteId` parameter for logged-id users, for which you have data uniquely identifying them.
96
+
The value of this parameter serves as a persistent, cross-device identifier of the user.
97
+
Example values are [User ID](https://content.raptorservices.com/help-center/user-tracking-understanding-soft-ids-hard-ids-raptor-identity-matching#:~:text=IDs%3A-,UserId%20%28Website%20ID) or the Cookie ID.
98
+
99
+
The value of `websiteId` parameter is resolved in the following order:
100
+
101
+
1. Explicit `websiteId` passed in the `ibexa_tracking_track_event()` context.
102
+
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).
103
+
3. The built-in provider, which uses the logged-in user's identifier (`ruid`).
104
+
105
+
If no value is resolved, the event is sent without the `p7` parameter.
106
+
107
+
To resolve `websiteId` on the project level, implement the interface as follows:
108
+
109
+
```php
110
+
namespace App\Tracking;
111
+
use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
112
+
use Ibexa\Contracts\Core\Repository\PermissionResolver;
113
+
use Ibexa\Contracts\ConnectorRaptor\Tracking\ContextProvider\WebsiteIdContextProviderInterface;
114
+
final readonly class MyCrmWebsiteUserIdProvider implements WebsiteIdContextProviderInterface
0 commit comments