Skip to main content
Under current case law, tracking, cookies and comparable advertising effectiveness research tools may only transfer data once the visitor has actively consented. A notice is not sufficient, and pre-ticked checkboxes are not permitted. Clarify the implementation with your data protection officer before carrying out any of the following steps.
econda Cross Sell shows visitors product recommendations based on the behavior of all visitors and on their own profile. Because the display runs via a shop template, the recommended products look exactly the same as everywhere else in the shop, and a design change takes effect in both places. Four pages are supported:
  • Shop home page ws_start.htm
  • Product overview page ws_category.htm
  • Product detail view ws_product.htm
  • Basket page ws_basket.htm

How it works together

The process is the same on all four pages:
  1. An econda widget requests recommendations and receives a product list.
  2. A callback function converts this list into shop parameters.
  3. The shop loads its own template via AJAX, which displays these products using shop tags.
  4. The content is placed in a prepared area of the page.
The only difference is which context the widget receives, i.e. whether it knows the current category, the current product or the basket contents.

Two approaches

Everything else is the same. The following instructions describe the recommended approach; the differences are noted where applicable.

Preparation

After placing the order, you receive an account ID and one or more widget IDs from econda. Share these with WEBSALE. Technically, you could start right after that. It makes more sense to first clarify what the widgets should return, because this determines which context you pass.
On the home page, category page and product page, requests are additionally made with profile identifiers, i.e. visitor, customer, user or recipient ID, provided the visitor is recognized. When this should happen is the most important question when setting up the widgets. How the recommendations are generated from this is configured in the econda interface.

Setup

Step 1: Include JavaScript files

Without tracking interface: With tracking interface, instead:
Materials: WEBSALE JavaScript library

Step 2: Add functions to the design component

Four functions are called at fixed points. They may remain empty but must exist. Use them to build loading indicators, messages and animations.

Step 3: Define the display area

An HTML element with an ID marks the position where the recommendations appear. It remains empty; the content is inserted later via AJAX.
If you show several widgets on one page, each needs its own area with its own ID and its own template. Otherwise, the second response overwrites the content of the first.

Step 4: Include the JavaScript

It is recommended to include it below the display area in the <body>.
With the tracking interface, the outer wrapping window.econda.ready(() => { ... }); is omitted; the content remains the same.
You can also place the script in the <head> section. In that case, the call must wait until the page has loaded:

The context per page

Only this one part differs between the four pages. Home page, without context:
Product overview page, with the category path:
Product detail view, with category path and product:
Basket page, with all products in the basket:
The counter places the comma between the entries, but not before the first one. Without it, the list would not be valid JavaScript.

Step 5: Create the widget template

Create a template with the name specified in WS-AJAXLoadTpl(). It must contain an AJAX area whose name carries the ID from step 3.
Within the PR-LoadData() wrapper, all the usual product tags are available. This gives you complete freedom in the design.
WS-EnsureNextLinkContainsURLParams ensures that the appended parameter starts with the correct separator. With SEO URLs, this cannot be predicted.
If econda returns no products, the display area remains empty. How to show something else instead is described further below.
Reference: PR-LoadData() · WS-Ajax-”ID” · WS-AJAXLoadTpl() · WS-EnsureNextLinkContainsURLParams · WS-PRListFromLoadTplLink_addlink · WS-PRListFromLoadTplLink_data · WS-PRListFromLoadTplLink_id · WS-PRListFromLoadTplLink_type

The JavaScript in detail

The code consists of two blocks: the callback function and the widget.
For several widgets on one page, the second block is repeated, each with its own callback function and its own template. If you exceptionally use the same template, the name of the AJAX area in it must be changed per widget, for example via a one-time parameter.
In the econda control panel, you define what kind of data a widget returns, for example top sellers or “bought together”. The decision about which widget appears on which page is therefore made there and not in the template.

Adding a fallback display

If econda returns nothing, the position remains empty in the default state. Instead of the gap, something else can be shown, for example the shop’s cross links.

Step 1: Adjust the JavaScript

Two changes: the abort is removed so that the template is loaded even without econda data. And a one-time parameter is appended to the tag, passing the current product index to the template.

Step 2: Adjust the widget template

The positive wrapper shows the econda recommendations, the negative one the fallback.
The one-time parameter from step 1 is the reason the template knows which product is involved in the fallback case at all. Without it, there is no basis for the cross links.
With the fallback display, an AJAX call to the shop is made on every page view, even if econda returns nothing. This is the price for the position never remaining empty.
Reference: WS-OTPX() · Cat-AdvData()

Showing recommendations in a slider

With many recommendations, a slider is clearer. The integration works as described above; only the animation call belongs in the function that is called after successful loading. Only then are the products in the display area.
Do not call the animation when the page loads. At that point, the display area is still empty, and the slider would have nothing to show.

Switching from “with interface” to “without interface”

The procedure is the same as for tracking: the old integration keeps running, the new one is built alongside it in design test mode and only swapped in after a successful test.
  1. Have WEBSALE activate free positioning of the tracking interface.
  2. Move the content of ws_analyse.js to a separate file and remove it from ws_analyse.js.
  3. Include this file together with WS-ExternalStatistics in {!ST-DesignTest} on all pages.
  4. Build the new integration in ST-DesignTest.
  5. Check in design test mode.
  6. Remove the wrappers and clean up the old integration.
Guide: Integration of econda
  • Guide: Integration of econda
  • Guide: Accessory products (Cross Links)
  • Guide: How WEBSALE AJAX integrations work
  • Guide: Consent to data processing (cookies)