- 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:- An econda widget requests recommendations and receives a product list.
- A callback function converts this list into shop parameters.
- The shop loads its own template via AJAX, which displays these products using shop tags.
- The content is placed in a prepared area of the page.
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:
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.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: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 inWS-AJAXLoadTpl(). It must contain an AJAX area whose name carries the ID from step 3.
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.
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.
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.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.- Have WEBSALE activate free positioning of the tracking interface.
- Move the content of
ws_analyse.jsto a separate file and remove it fromws_analyse.js. - Include this file together with
WS-ExternalStatisticsin{!ST-DesignTest}on all pages. - Build the new integration in
ST-DesignTest. - Check in design test mode.
- Remove the wrappers and clean up the old integration.
Related topics
- Guide: Integration of econda
- Guide: Accessory products (Cross Links)
- Guide: How WEBSALE AJAX integrations work
- Guide: Consent to data processing (cookies)
