Integrate recommendation service¶
To return recommendations, you must first enable the Personalization service. Next, integrate the service with Ibexa DXP by activating event tracking and embedding recommendation results into the website.
Note
Examples below use '00000' as a customer ID for creating requests. In a real-life scenario, use the customer ID that you receive from Ibexa.
Track events¶
The service primarily relies on event tracking. For the events to be registered, every Content item or product page must call a special tracking URL. The easiest way of embedding the tracking URL is placing a one pixel image on every page, like in the case of analytical tools or visitor counters. A code that includes an image looks like this:
<img href="https://event.perso.ibexa.co/ebl/00000/click/<user_ID>/<content_type_ID>/<content_ID>" width="1" height="1">
where:
-
<user_ID>
stands either for the user ID or session ID of the user who is currently logged into your website (any URL-encoded string is allowed). -
<content_type_ID>
stands for the contentTypeId of the Content item or product that you want to track and recommend. -
<content_ID>
stands for the id of the Content item or product that you want to track and recommend.
The following examples show how you can integrate a CLICK event:
PHP:
1 2 3 4 5 |
|
JavaScript:
1 2 3 4 5 6 |
|
A similar tracking image can be placed on a confirmation page that ends the payment process.
1 2 3 4 5 |
|
Embed recommendations¶
As soon as the Personalization server collects enough events, it can generate recommendations. The more tracking data is available, the more accurate the recommendations. Recommendations can be fetched with the following calls, and the response is returned in JSON format.
To return the most popular products, use:
https://reco.perso.ibexa.co/api/v2/00000/<user_ID>/landing_page.json
To return products that the current user is most probably interested in, use:
https://reco.perso.ibexa.co/api/v2/00000/<user_ID>/cross_sell.json?contextitems=OWNS,CLICKED
To return products that are most probably interesting for users interested in product 123, use:
https://reco.perso.ibexa.co/api/v2/00000/<user_ID>/cross_sell.json?contextitems=123
A response with two recommendations resembles the following object:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
You can use the following code to make requests and parse results:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
Advanced integration¶
You can configure integration at a more advanced level to track more events, use additional parameters, apply custom scenario configurations, filters, and enable additional features.
For more information about available functionalities, see theĀ User Documentation.
For more information about integrating the Personalization service, see tracking API and tracking integration documentation.