Tracker - boxalino/rtux-integration-magento2 GitHub Wiki

Before you continue, make sure the required integration steps have been completed.

In order to have meaningful real-time recommendations and relevant statistics for the reports, the API tracker must be enabled.

The API narrative tracker is able to follow user-activity, to closely track what content the user is currently viewing and/or what has left an "impression" on the visitor.

Template requirements

In order to receive the relevant tracking information, the proper markups must be used in the templates.

If your integration relies on the default theme files, please apply the markups on:

  • Magento_Catalog::product/list.phtml (search, navigation)
  • Magento_Catalog::product/list/items.phtml (cross-sell/up-sell/related/etc)
  • Magento_Catalog::product/view/addtocart.phtml (product view - for add-to-basket tracking)

Samples on how the HTML mark-ups are set on the template can be seen:

For proper tracking of the addToBasket event, the HTML mark-ups must be added. https://boxalino.atlassian.net/wiki/spaces/BPKB/pages/8716641/JS+Tracker+API#addToBasket-element

In case the deployment is happening gradual, it is required to also update the theme templates as instructed: https://boxalino.atlassian.net/wiki/spaces/BPKB/pages/8716641/JS+Tracker+API#Detached-item-element

  • update the add-to-cart button from the main templates (ex: bx-basket-add CSS class)
  • update the product items with (ex: bx-narrative / bx-narrative-item CSS classes, data-bx-item-id attribute)

Integration

the tracker logic is provided in the framework layer; the integration layer is used to activate or update

  1. Planning for the integration

The following events are available: page view, category view, product view, search event, add to basket, login and order. These are not enabled by default but are part of a widget (ex:rtuxApiTracker) - part of the integration layer.

  1. Create the rtuxApiTracker JS in the integration repo

The logic of each tracked event is part of the widget requirements; The benefit is that you can create custom logic if the project does not follow Magento2 standards.

  1. Add the events.xml for the order and login events

    • The order event is tracked server-side with the use of an observer; the event to which is linked can be updated based on your checkout strategy.

    • For the login event is tracked with the use of an observer

  2. Create a tracker template to initialize the tracker widget

  3. Enable the tracker on front-end by updating the requirejs-config and adding the template to layout.xml

  4. Compile the theme (if needed)/clear cache.

Technical references

For more information or extended use-cases, please consult the JS Tracker API documentation