.. |searchbox| image:: img/searchbox.png :alt: Searchbox Tracking .. |searchbutton| image:: img/searchbutton.png :alt: Searchbutton Tracking .. |resultCount| image:: img/resultCount.png :alt: Result Count Tracking .. |basketPDP| image:: img/basketPDP.png :alt: Add to basket PDP Tracking .. |basketPLP| image:: img/basketPLP.png :alt: Add to basket PLP Tracking .. |checkout| image:: img/checkout.png :alt: Checkout Tracking .. |product| image:: img/product.png :alt: Product Tracking .. |suggest| image:: img/suggest.png :alt: Suggest Tracking .. |associatedProduct| image:: img/associatedProduct.png :alt: Associated Product Tracking .. |redirectSubSelector| image:: img/redirectSubSelectors.png :alt: Tracking Redirects .. _search-collector: https://github.com/searchhub/search-collector Search Collector ================ Introduction ############ To gather the required tracking data the open-source search-collector search-collector_ tracking library is used. The search-collector library scans the HTML DOM to gather search-related data and user events. To integrate the tracking, only a couple of HTML attributes have to be attached to your page. The remaining search-collector implementation is done by searchHub. .. note:: Our tracking script is capable of reading javascript objects to obtain the necessary data. To find out more about tracking customizations, just contact us directly or look for a hint in the documentation. .. TODO mention the sr is the foundation Rule of Thumb ############# *If you are not sure which HTML element exactly to put the data-attribute on, using the elements you use for specific user events is a good rule of thumb.* *E.g. if your click listener for the search button is attached to an HTML button element, you should add the corresponding collector HTML attribute to that button element.* Script ###### Include your searchHub tracking snippet on every page in your shop like: .. code-block:: html Replace the ``{SCRIPT_ID}`` with the unique script id searchHub provided for you. The script will automatically load and execute. Please do not confuse the ``SCRIPT_ID`` with the searchHub api key. If you do not have the ``SCRIPT_ID`` please contact your searchHub representative. Integration ################ Search box ------------------------------ The ``searchbox`` is used to perform text-based queries. In most cases, the ``searchbox`` is an HTML input element. |searchbox| .. list-table:: data-attributes :widths: 50 50 :header-rows: 1 * - Name - Value * - data-track-id (required) - searchBox **Example** .. code-block:: html Search button --------------------------------- The ``searchbutton`` is used to trigger a search. |searchbutton| .. list-table:: data-attributes :widths: 50 50 :header-rows: 1 * - Name - Value * - data-track-id (required) - searchButton **Example** .. code-block:: html Add to cart (PDP) ---------------------------- On the product detail page the ``Add to cart`` button has to be attributed with the ``data-track-id`` and ``data-product-id`` attributes. An additional element containing the amount put into the basket can be annotated with the ``data-track-id`` attribute, in most cases this is a common div, select or input element. |basketPDP| .. list-table:: data-attributes :widths: 50 50 :header-rows: 1 * - Name - Value * - data-track-id (required) - addToCartPDP * - data-product-id - {mainId} * - data-track-id - addToBasketQuantity .. note:: You can omit the `data-product-id` and `data-track-id="addToBasketQuantity"` attributes if you have a javascript object that contains the required information. E.g. the `dataLayer` object. Please contact us if you want to rely on js data. **Example** .. code-block:: html Associated Product ---------------------------- If on product detail page some associated products (recommendations, similar products and so on) are proposed to the shop user, these products should be annotated almost the same way as products are annotated on the product listing page. The only difference is the ``associatedProduct`` value of the ``data-track-id`` attribute. |associatedProduct| .. list-table:: data-attributes :widths: 50 50 :header-rows: 1 * - Name - Value * - data-track-id (required) - associatedProduct * - data-product-id - {mainId} * - data-track-id - priceContainer .. note:: You can omit the `data-product-id` and `data-track-id="priceContainer"` attributes if you have a javascript object that contains the required information. E.g. the `dataLayer` object. Please contact us if you want to rely on js data. **Example** .. code-block:: html ...
39,99 € per unit
...
Checkout ---------------------------- Checkout tracking is implemented on the very last summary page in your checkout process. All products have to be attributed similar to the product listing page in addition to the ``"Commit and Buy"`` button which will finalize the order. |checkout| .. list-table:: data-attributes :widths: 50 50 :header-rows: 1 * - Name - Value * - data-track-id (required) - checkoutProduct * - data-track-id (required) - checkoutButton * - data-product-id - {mainId} * - data-track-id - priceContainer * - data-track-id - checkoutQuantity .. note:: You can omit the `data-product-id`, `data-track-id="priceContainer"` and `data-track-id="checkoutQuantity"` attributes if you have a javascript object that contains the required information. E.g. the `dataLayer` object. Please contact us if you want to rely on js data. **Example** .. code-block:: html
...
2
...
19.99 €
...