Recommendation campaigns display the most relevant items to each user. Our machine-learning engine calculates decisions based on your selected strategies, data feed, user behavior, and general user trends. Depending on your settings, additional filters can be applied to limit the results. When the list is complete, the items are sorted by the scores applied by the recommendations engine, relevance to the user, and context, and the top results are displayed.
Create a recommendation widget
- Go to Web Personalization › Create Campaign › Recommendations
- Enter a name, and optionally, add notes and labels.
- Specify the campaign settings such as page type, insertion method, and advanced settings. See the recommendation campaign settings section for more information.
- Configure the targeting settings of the experience to determine when, where, and to whom the experience is displayed.
- Create variations using templates, based on other experiences, or using a data feed.
- Template: When creating a new recommendation widget variation, you can create a custom HTML template or select one of the Dynamic Yield out-of-the-box templates.
-
Design: The variable tab provides customization possibilities, such as the number of items and their attributes (title, length, price). It also includes the widget’s recommendation strategy.
The strategy dropdown menu is populated with relevant strategies based on the previously defined page type. The menu icon provides additional options: Creating a new strategy, editing an existing one, or duplicating a strategy for tweaking and saving as new. Learn more about Recommendation Strategies.
Note: The preview pane does not reflect the chosen strategy.
- When you are done with each variation, click Save Variation.
- Set the allocation, primary metric, and advanced experience settings.
- Configure how much of your traffic to allocate to each variation to the control group.
- Click Save Experience.
- Click the plus icon to create an additional targeted experience.
- To see what the campaign looks like, click Preview. Click Save and Publish when everything is to your liking.
- To track the performance of your recommendations, click the report icon next to the campaign name.
Add recommendations to other campaign types
You can add recommendations to other types of Dynamic Yield campaigns, such as overlays and notifications. To do this, create a specialized template and use it when creating the campaign. To add recommendations to an email campaign, see Experience Email.
To create a template:
- Go to Assets › Templates and click Add New.
- Select the template type, and select Enable product recommendations.
- Create the template using HTML, CSS, and JavaScript.
- To display a recommendation, insert the following code into the HTML tab:
${#Recommendation} <a class="rec_item" href="${url}"> <img src="${Image}" /></a> <div class="rec_name">${Name}</div> ${/Recommendation}
The Recommendation tag wraps the HTML of the single item design. To display the relevant image, product, post name, or any other property, set the variable type to Feed Property, and then select the corresponding property (see image).
When you add this tag to your HTML, a new variable – Recommendation Strategy – appears in the Variables tab. This variable lets you select the recommendation algorithm and the number of items to present in the recommendation.
- Save the template.
- To use the template, select it from the My Templates tab when creating a variation.
Recommendation campaign settings
When you create a recommendation campaign, you specify settings including page type, insertion method, and other advanced settings. This section contains details about these settings.
Page type
This setting determines the page type the recommendation is placed on. Select Any Page if none of the options fit your use case.
Note that after you select a page type and save the campaign, you can no longer change the page type. If necessary, duplicate the campaign or create a new one.
Location
Notes:
- All campaigns must be placed inside the <body> tag. Placing them anywhere else is unsupported, as it might result in unexpected browser behavior.
- Tip: To run a campaign at the beginning or end of the body, use the body:first-child and body:last-child properties.
Recommendations can be inserted and placed onto any page of your website using the following methods:
- Replace Element: Dynamic Yield will render the Recommendation, replacing an existing element on your site with no need for you to apply technical or IT resources. You specify the element to replace as a CSS Selector. Dynamic Yield hides all the existing tags within the element and adds the campaign content.
- Add After Element: The same as Replace Element, but the element is placed just after a specific CSS selector.
- Add Before Element: The same as Replace Element, but the element is placed just before a specific CSS selector.
- Embed with Code: Implement a recommendation directly into your website’s source code (Dynamic Yield won't render it). After publishing the campaign, hover over the campaign name and click the code icon to locate the code.
For the first three options, you must specify on which pages Dynamic Yield should render the campaign.
Advanced settings
- Serve on Every SPA Event: Relevant for single-page applications that don’t generate a browser refresh with every screen change. If you need the recommendation to relaunch or reevaluate its targeting conditions upon every screen change in your SPA, fire a track_pageview event and enable this option.
- Optimize Site Loading Time: Stores the experience offsite to maximize overall site loading speed. Recommended primarily for experiences below the fold to reduce the risk of flicker.
-
Analytics Integrations:
- Fire a Google Analytics event (legacy): Only visible if the Google Analytics integration is enabled. You can disable this option to prevent reporting data to Google Analytics about a specific recommendation.
- Track campaign performance in your analytics platform: Fires events for any analytics extensions and custom code you have implemented. If you disable this option, it won't fire events to any of your analytics implementations.
-
Wait for Element: Don't render the recommendation until an element has loaded or a condition has been met. Used primarily for troubleshooting purposes or to ensure that Google Analytics is tracking the recommendation properly. Select one of the following options, or use the + and option to specify more than one element to wait for:
- None (default): Do not wait for anything before rendering the recommendation.
- CSS Selector: Wait for an element to load on the page defined as a CSS Selector.
- JQuery Library: Wait for the JQuery library to load.
- Google Analytics (classic): Wait for Google Analytics (classic) to load.
- Google Analytics (universal): Wait for Google Analytics (classic) to load.
- Dynamic Yield Data: Wait for Dynamic Yield data (such as social proof metrics) to load.
- External Component: Wait for any custom-defined JavaScript function to load on the page.
Preventing recommendation duplication
If more than one recommendation widget exists on a single page, Dynamic Yield automatically prevents the same results from displaying in more than one widget, as follows:
- Dynamic Yield evaluates all recommendation strategies requested on the page.
- Recommendation strategy requests are consolidated into a single request and sent to the recommendations engine.
- Strategy requests are calculated one by one by the recommendations engine. As results are returned, they are automatically excluded from subsequent strategy results.
- Recommendations results are returned and rendered by Dynamic Yield.
In the following cases, recommendation results are not excluded even if they were returned in previous strategy results:
- Activity-based recommendations, such as recently viewed products or recently purchased products.
- Products pinned to specific slots using filtering rules.
This process applies to recommendations that are rendered by Dynamic Yield. If you are rendering recommendations manually using the recommendationWidgetData API, you can use the exclude parameter to limit the results of each recommendation widget to prevent duplication.