Solutions / Ecommerce / Sponsored products / Guides

Considerations for analytics, UI, and legal compliance

Integrating sponsored products from a retail media platform (RMP) into an Algolia-powered search experience may require some trade-offs. This guide outlines essential considerations, including how sponsored content affects analytics and events, UI considerations like pagination, display requirements in InstantSearch, proper labeling to meet regulatory obligations, and ensuring ranking maintains user trust.

Regulatory requirements

In most regions (including the US, EU, and Canada), sponsored products must have a visual badge (such as “Sponsored”) on each injected product. For that reason, the code for each strategy adds a sponsored: true attribute to each “sponsored product” result.

Under regulations like the EU Platform to Business, you may also need to disclose how paid placements influence your search ranking.

Effect on analytics and events

Algolia click and conversion tracking can capture interactions with sponsored products but only under specific conditions:

  • The sponsored products must exist in an Algolia index (not just the RMP).
  • Send the objectID for each sponsored product with each click or conversion events.

However, some limitations remain:

  • Algolia Insights. Algolia can’t tell if a click or conversion event applied to a sponsored or a regular product.
  • Analytics. You can’t separate click-through (CTR) or conversion rates (CVR) for sponsored and regular products. CTR is a combination of the sponsored and regular product CTR. A combined CVR is similarly calculated.

    Click position accuracy is also reduced since the recorded position no longer matches the physical position.

  • Dynamic Re-Ranking. The boosting of sponsored product placements distorts Dynamic Re-Ranking’s learning process.

UI considerations

Injecting sponsored products into search results affects how users interact with the interface, its effects on pagination and how to display results with InstantSearch.

Pagination

Injecting sponsored items affects the number of items per page. For example, if Algolia returns 48 items and you inject 2 sponsored ones, the user sees 50. This can push some regular results to the next page.

You can accept these overflows or change the hitsPerPage value.

Display with InstantSearch

If your frontend uses InstantSearch, you should proxy all search requests through your backend (for the merging and injection).

Ensure favorable ranking for sponsored items

Sponsored product placements should only improve visibility, not reduce it. For example, if a Nike shoe ranks third as a regular result and is also a sponsored product, don’t move it to a lower sponsored position, like 8 or 12.

To ensure this happens, update your strategy’s injectSponsoredProducts function. For example:

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * Injects sponsored products into regular hits at specific positions defined by SPONSORED_PRODUCT_POSITIONS.
 * For products in both lists, only move them if the sponsored position is better than the regular product position.
 * @param {Array} regularHits - The array of regular product hits from Algolia
 * @param {Array} sponsoredHits - The array of sponsored product hits from the RMP
 * @returns {Array} Combined array of regular and sponsored hits with sponsored products at specified positions
 */
function injectSponsoredProducts(regularHits, sponsoredHits) {
 // If no sponsored products, return regular hits "as is"
 if (!sponsoredHits || sponsoredHits.length === 0) {
 return regularHits;
 }

 // Make a copy of regular hits
 let finalHits = [...regularHits];

 // Go through each sponsored product
 for (let i = 0; i < sponsoredHits.length; i++) {
 // Stop if there are no more positions to put sponsored products
 if (i >= SPONSORED_PRODUCT_POSITIONS.length) {
 break;
 }

 let sponsoredProduct = sponsoredHits[i];
 let desiredPosition = SPONSORED_PRODUCT_POSITIONS[i];

 // Find if this product already exists in the results
 let currentPosition = result.findIndex(product => product.objectID === sponsoredProduct.objectID);

 // Add a sponsored flag to the product (displays "Sponsored" in the UI)
 let sponsoredProductWithFlag = { ...sponsoredProduct, sponsored: true };

 // Sponsored product isn't in the regular results yet
 if (currentPosition === -1) {
 // Don't try to insert beyond array length
 let insertPosition = Math.min(desiredPosition, result.length);
 result.splice(insertPosition, 0, sponsoredProductWithFlag);
 }
 // Sponsored product exists in regular results but at a lower position
 else if (currentPosition > desiredPosition) {
 // Remove from the current position and insert at a higher position
 result.splice(currentPosition, 1);
 result.splice(desiredPosition, 0, sponsoredProductWithFlag);
 }
 // Sponsored product exists at the same or a higher position: do nothing
 }

 return finalHits;
}

Complementary sponsored products

RMPs such as Criteo sometimes return complementary sponsored products, which, while not strictly relevant, can be beneficial. For example, the query “running shoes” could also display contextually relevant sponsored products like GPS watches or performance socks.

However, in more trust-sensitive domains like healthcare, this can be problematic. For example, if a user searches for “headache medication” and sees sponsored products for muscle pain relief, it can undermine their trust.

To ensure sponsored products are contextually appropriate, before injecting sponsored products into results, compare their categories to those in the regular results. Add a category matching check to your strategy’s injectSponsoredProducts function. You can use strict or flexible matching:

  • Strict matching. The sponsored product must belong to the same category (for example “men’s running shoes”).
  • Flexible matching. The sponsored product can share a broader parent category (for example “men’s shoes”).
Did you find this page helpful?