Recommendation Tracking

Prev Next

The Recommendation Tracking extension enables product-level analysis of recommendation widgets in Mapp Intelligence.

It records when recommended products are displayed or clicked and sends additional widget context, such as placement, product position, and algorithm. If a recommended product is clicked and later purchased within seven days, the stored widget context is included in the purchase request. Attribution follows a last-click approach.

These values are passed via predefined E-Commerce parameters.

Full implementation guide

For details on setup, configuration, parameter requirements, and reporting, see the dedicated Recommendation Tracking plugin documentation.


Methods and properties

name

Get the name of the extension.

/**
 * @type {string}
 */
wtSmart.extension.recommendation_tracking.name;

version

Get the version of the extension.

/**
 * @type {string}
 */
wtSmart.extension.recommendation_tracking.version;

config

Set and get the current configuration of the extension.

  • maxSendProducts

    • session: Maximum number of recommendation tracking events sent per browser session. Once this limit is reached, no additional recommendation events are sent in the same session. Use -1 to track all.

    • page: Maximum number of recommendation tracking events sent per page view. Once this limit is reached, no further recommendation events are sent on the current page view. Use -1 to track all.

  • maxCookieSize: Maximum size of the recommendation tracking cookie (in characters).

    When the cookie is full and a new recommendation needs to be stored, the oldest entry is removed and the new one is added.

    Use -1 to disable cookie usage. In this case, recommendation clicks and subsequent purchases are no longer linked for conversion attribution.

/**
 * @param {{
 *      [maxSendProducts]: {
 *          [session=10000]: number,
 *          [page=1000]: number
 *      },
 *      [maxCookieSize=4000]: number
 * }} [config]
 *
 * @returns {object}
 */
wtSmart.extension.recommendation_tracking.config(config);

isActivated

Get the status of whether the extension is enabled.

/**
 * @returns {boolean}
 */
wtSmart.extension.recommendation_tracking.isActivated();

activate

Activate the extension.

wtSmart.extension.recommendation_tracking.activate();

deactivate

Deactivate the extension.

wtSmart.extension.recommendation_tracking.deactivate();

add

After the Recommendation Tracking extension has been integrated and activated, you must explicitly define which elements on your website should be tracked as recommendations.

Display events are triggered automatically as soon as elements matching the selector appear in the DOM. This also works for lazy-loaded content and SPA environments, as no separate view event is required.

  • selector: CSS selector or direct element reference for the recommendation element. All default clickable elements inside it will be tracked (a, area, button, input[type="submit"]).

  • shadowRoot: CSS selector of a shadow DOM root, if the selector is located inside a shadow DOM.

  • exclude: Array of CSS selectors or elements to exclude from recommendation click tracking (e.g., legal links).

  • data

    Field

    Required

    Description

    id

    Yes

    Product identifier (same value as used for product tracking)

    cost

    Yes

    Product price (total for quantity)

    currency

    No

    ISO currency code, e.g., "EUR"

    placement

    Yes

    Widget placement (e.g., PDP, homepage)

    algorithm

    Yes

    Algorithm (e.g., similar items, trending)

    position

    Yes

    Product position in widget (e.g., 3)

Note

The recommendation tracking cookie stores all fields provided in the data object (e.g., id, placement, algorithm, position) for up to seven days so they can be included in the purchase request if the product is bought later.

/**
 * @param {{
 *      selector: string | HTMLElement,
 *      [shadowRoot]: string,
 *      [exclude]: string[] | HTMLElement[],
 *      data: {
 *          id: string,
 *          cost: string | number,
 *          [currency]: string,
 *          [placement]: string,
 *          [algorithm]: string,
 *          [position]: string | number
 *      }
 * }} item
 */
wtSmart.extension.recommendation_tracking.add({
    selector: "li.item:nth-of-type(2)",
    shadowRoot: "#product-collection",
    exclude: ["li.item:nth-of-type(2) a:last-child"],
    data: {
        id: 'MP12',
        cost: 19.95,
        currency: 'EUR',
        placement: 'pdp',
        algorithm: 'similar items',
        position: 3
    }
});

Example

// is recommendation tracking activated
var isActivated = wtSmart.extension.recommendation_tracking.isActivated();

// set recommendation tracking config
wtSmart.extension.recommendation_tracking.config({
    maxSendProducts: {
        session: 10000,
        page: 1000
    },
    maxCookieSize: 4000
});

// activate recommendation tracking
wtSmart.extension.recommendation_tracking.activate();

// deactivate recommendation tracking
wtSmart.extension.recommendation_tracking.deactivate();

Debugging recommendation tracking

To verify that recommendation events are firing correctly, use your browser’s developer tools or the Mapp Cloud debugger:

  1. Open the page with a recommendation widget and start the Debugger.

  2. Trigger the events (widget display, click, and later a purchase).

  3. Check the outgoing requests and verify that the following values are sent:

Event

How to trigger

What you should see in the Mapp Cloud Debugger

Widget product displayed

Load the page until the recommendation widget becomes visible.

A product with status display-reco and the configured product fields (id, cost, placement, algorithm, position). The widget context parameters 765 (placement), 766 (product position), and 767 (algorithm) appear in the request.

Widget product clicked

Click a product inside the recommendation widget.

A product with status click-reco plus the same product fields and the widget context parameters 765 / 766 / 767. This confirms that recommendation click tracking works.

Purchase after a recommendation click

Complete a test purchase for a product that was previously clicked in a recommendation widget (within seven days).

A normal purchase status (e.g., conf) — not a recommendation-specific status — together with the widget context parameters 765 / 766 / 767. These parameters show that the purchase is linked to a prior recommendation click and enables attribution.