If you are using Predict’s product recommendations for web or email, you can easily integrate your Demandware shop and collect the data you need to make relevant product recommendations. You should do this right after you have finished configuring your basic custom preferences.

For a full list of the Predict preferences, see: Predict and Smart Insight Site Preferences.

Contents

Enabling the Web Extend data collection scripts

If you are a Predict client, the Web Extend data collection scripts are automatically added to your web shop when you install the Emarsys cartridge.

For these scripts to start collecting data, they need to be enabled in the EmarsysPredict Configuration page. To do this, open the Business Manager and go to Merchant Tools > Site Preferences > Custom Site Preferences and open Emarsys Predict Configuration.

demandware-enable-predict

Here you can also select the widget type to show on your storefront.

The following widgets are available:

  • Personal
  • Home
  • Related
  • Also Bought
  • Cart
  • Category

They can be displayed on the following pages:

  • Thank You For Your Order page
  • Product Detail page
  • Home page
  • Cart page
  • Search page
  • Category page

demandware-predict-widgets

Checking the data collection

Once you have installed and enabled your data collection scripts and widgets, you can easily check that they are working by going to your storefront and visiting pages where the code has been installed (category page, search page, pdp, etc.). At the same time, open the Predict Dashboard in your Emarsys account.

As you click around your storefront, you should see Predict tracking your actions in real time.

demandware-check-web-extend

Preparing your product data fields for export

In the Demandware Predict Configuration page you can add (and remove) the Demandware fields that you want to include in your daily export, and map them to Emarsys fields. These fields will be prepared in a .csv file that will be placed on the storage location that you define below. The export file structure is as follows:

  • Name: products_<YYYYMMDDHHiiss>_<shopinfo>.csv
  • Encoding: UTF-8
  • Columns separator: Comma ( , )

To select and map your fields, open the Business Manager and go to Merchant Tools > Emarsys Integration > Predict Configuration.

demandware-configuration-predict-fields

The following fields are mandatory for the .csv file:

  • Item – The unique product ID.
  • Available – Determines whether the is product available (and can therefore be recommended); values are TRUE or FALSE.
  • Title – The product title.
  • Link – The deep link to the product.
  • Image – The URL of the product image.
  • Category – The category path to the product separated by ‘ > ‘, e.g. books > sci-fi > Snow Crash.
  • Price – The price of the product (float value 1234.99).

In addition to these you can add custom product fields. Click Add fields and select the field you want to add from the Available elements list. Define the column name (which must be the same as the Emarsys field name to which it is mapped) for that field, then repeat for all the additional fields you want. Remember that the column name for these fields must begin with c_.

Note: Only custom fields that you have defined in the emarsysPredictProductAttributes site preference are listed here (in the Custom Site Preference Groups > Emarsys Predict Configuration).

You can also define the export type:

  • Export only the main product, with no product version (this is the default setting)
  • Export each product version / each combination of product versions

Configuring the daily export

To configure Demandware for Predict, proceed as follows:

In the Business Manager, go to Merchant Tools > Site Preferences > Custom Site Preferences and select EmarsysPredict.

demandware-configuration-predict-1

This will open the EmarsysPredict Configuration.

demandware-configuration-predict-2

Make the following settings:

  • Predict Merchant ID – This is your Predict merchant user ID and can be found on the Account Details section of the Predict Dashboard in your Emarsys account.
  • Predict: Enable tracking code – Enable or disable the Web Extend Javascript tracking code for your site.
  • Emarsys SFTP Host – The Emarsys SFTP server host for Predict.
  • Emarsys SFTP Username – The Emarsys SFTP server username for Predict.
  • Emarsys SFTP Password – The Emarsys SFTP Server password for Predict.
  • Emarsys Predict SFTP Path – The folder name for the Emarsys Predict SFTP Server where product export will be uploaded.

demandware-configuration-predict-3

  • List of Product Variation attributes for Predict feed – A list of product variation attributes used for the Predict feed (to ensure that, for example, the correct size or color of shoe is recommended). All the product variation attributes should be added here (they must already exist in Dedmandware or this will cause an error).

demandware-configuration-predict-4

  • Predict: Product attributes for exporting – A list of product attributes for the export feed. These are matched to the fields in Emarsys and must conform to the syntax requirements of the Predict product catalog. See Custom fields for export below for more details.

When you have finished configuring your export file, you can check that the fields have been correctly selected and mapped by going to Custom Objects > Custom Objects > predictConfig > General and checking the Mapped fields box. Here are all the fields that you selected above.

Setting up the export job

Now you must set up the Demandware job that will collect the product data, compile the .csv file and place it on the export SFTP server.

In the Business Manager, go to Administration > Operations > Workflow schedules, select the Emarsys Predict job and click Edit.

demandware-predict-export-job

Here you configure the Emarsys Predict job:

  • Enabled – This enables or disables the job on your Demandware site.
  • Name – The name of the job.
  • Description – Description of this job.
  • Runtime – You define the frequency of the job.

demandware-si-export-job-schedule

When you have defined the frequency of the job, click Run. Then go to the SFTP server and check that the folder you created in the EmarsysPredict Configuration page is there and contains be new export file with products.

The file name should be in the correct format: products_<YYYYMMDD_HHiiss>_<shopinfo>.csv

demandware-predict-export-job-confirm

Open the new export file and check that the columns match the mappings for the fields you selected in the Predict Configuration page:

demandware-predict-export-job-check

Running the Predict workflow schedule

The EmarsysPredict workflow schedule exports catalog data into a .csv file via the Integration Framework. Every field in the .csv file will be mapped to a corresponding field in Emarsys.

To run the workflow, log in to the Business Manager and go to Administration > Operations > Workflow schedules and check if the EmarsysPredict workflow is scheduled daily. Then run the workflow.

demandware-predict-workflow

About the Predict product feed

Predict requires a .csv product data feed, which will be fetched from a remote location (HTTP / FTP / SFTP). Emarsys Predict attributes are configurable under the emarsysPredictProductAttributes site preference.

Some attributes are mandatory for the feed. Please note that in some cases the syntax of the value will be checked by Emarsys and must be valid in order for the feed to succeed.

  • product.ID
  • product.availability – Values can only be TRUEand FALSE.
  • product.name
  • product url – This require a valid URL.
  • product.images – This requires a valid image path and name.
  • product.categories – Multiple categories must be separated by a pipe |.
  • product.price – This must be a field of the type Float.

In addition to this, you can add any Demandware product standard and custom attributes, for example:

  • product.onlineFlag
  • product.skinConcern
  • product.custom.color
  • product.custom.size
  • product.shortDescription
  • product.longDescription
  • product.pageTitle
  • product.taxClassID
  • product.brand

Configuring the storefront cartridge

In order for your Predict recommendations to work, a few updates need to be made on the storefront cartridge.

footer_UI

In the storefront cartridge, find the footer_UI template and include the following code at the bottom of the template:

<isinclude template="components/predict/traking" />

demandware-setup-predict-1

productdetail.isml

Now find the productdetail.isml template and include the following code inside pdpMain div before the closing tag:

<iscomment>Include Emarsys predict on QV page</iscomment>

<isinclude template="components/predict/predictscriptqv"/>

demandware-setup-predict-2

cart.isml

Now find the cart.isml template and before the isese tag, under the <isif condition="${pdict.Basket == null || (empty(pdict.Basket.productLineItems) && empty(pdict.Basket.giftCertificateLineItems))}" condition near line 68, include the following code:

<iscomment>Predict Recommendations Widget Goes Here</iscomment>

<div id="predict-recs"></div>

demandware-setup-predict-3

Still in the cart.isml template, include the following code before the closing isif tag near line 874:

<iscomment>Predict Recommendations Widget Goes Here</iscomment>

<div id="predict-recs"></div>

demandware-setup-predict-4

confirmation.isml

Now find confirmation.isml template and include the following code before the closing isdecorate tag near line 34:

<iscomment>Predict Recommendations Widget Goes Here</iscomment>

<div id="predict-recs"></div>

demandware-setup-predict-5

htmlhead.isml

Now find the htmlhead.isml template and include the following code at the end of the template:

<isinclude template="components/predict/predictscript" />

demandware-setup-predict-6

homepage.isml

Now find the homepage.isml template and include the following code before the closing isdecorate tag near line 29@

<iscomment>Predict Recommendations Widget Goes Here</iscomment>

<div id="predict-recs"></div>

demandware-setup-predict-7

producttopcontent.isml

Now find the producttopcontent.isml template and include the following code before the closing isif tag near line 92:

<iscomment>Predict Recommendations Widget Goes Here</iscomment>

<div id="predict-recs"></div>

demandware-setup-predict-8

catlanding.isml

Now find the catlanding.isml template and include the following code before the closing isdecorate tag near line 30:

<iscomment>Predict Recommendations Widget Goes Here</iscomment>

<div id="predict-recs"></div>

demandware-setup-predict-9

productgrid.isml

Now find the productgrid.isml template and, before the <ul id="search-result-items"...> tag near line 9, include the following code:

<iscomment>Predict Recommendations Widget Goes Here</iscomment>

<div id="predict-recs"></div>

demandware-setup-predict-9