Zones
Adding Zones To Your Pages
Zones, also known as Merchandising Zones, are areas on the site that render PureClarity content such as a product recommender, an image, a carousel or custom HTML. Each Zone is an HTML<div> element with a reference to a zone ID, as a data attribute. The zone ID is a unique ID that references each zone configured in PureClarity for each page type. For example on the home page a zone with ID HP01 may represent as a banner image. A page can have multiple zones.
Below shows an example of a <div> element tagged with a zone ID:
<ID> with the ID of the zone. For example:
<div> if there is nothing to show. This allows sites to benchmark PureClarity or just show content from PureClarity for a particular Campaign.
Search Zones
There are 2 types of search specific zones, zones on the search results page and zones that can appear in an autocomplete drop down box. For zones on the search results page PureClarity uses a query string value in the URL to determine what the user searched for. For example, given the URL:www.yoursite.com/search?term=jar
The ‘jar’ was searched, and PureClarity gets this value by looking at the query parameter ‘term’. This query parameter can be set in the PureClarity Admin console under Configuration > Settings.
As autocomplete search implementations from site to site can vary significantly the autocomplete zone setup is a little more involved. For a full explanation of how to implement the autocomplete recommender please see the section on Personalized Recommendations in Autocomplete below.
Dynamic Zone Loading
When a page loads PureClarity will return the zones for that page, and inject content. Sometimes however you may need to dynamically load zone content later on, after a page has already loaded. An example would be loading the content of a specific zone that is in a category menu structure as a user hovers over it. As different categories are shown your site could dynamically load context aware zones for the specific category being viewed. In this way you can show personalized content for each user for each category they look at in the menu. The PureClaritygetzone function can be used to request one or more zones at anytime. Note that this will only return a result object and so your site will be responsible for adding the HTML to the page.
Below is JavaScript example code that will call PureClarity, with a context data object, and execute a callback function for you to process the result as you wish:
The
getzone function supports an additional context property called requesttype. This can be set to ‘model’, ‘html’ or ‘both’ to retrieve data model as well as html in the result.Personalised Recommendations In Autocomplete
If you want to provide personalization in an autocomplete drop down (instant search) on your site then this section will detail the steps required. Because there are lots of different autocomplete solutions on the market the exact way you integrate PureClarity will differ from one site to the next. The basic approach is to use Dynamic Zone Loading as a user types their search term into the search box. This will require adding some custom JavaScript to your site. We suggest the following approach:- In PureClarity setup an autocomplete recommender (AC-01).
- Set it to be an ‘AI Recommender’.
- When you setup a zone (such as AC-01) in the PureClarity Admin you can choose the minimum and maximum number of results you want to show. Set these based on the design of your autocomplete.
- You can create a custom template for the autocomplete if the results should be rendered differently to other recommenders on your site by using the Template management area in the Admin console.
- On your site, hook into the appropriate search hooks, such as when a user is typing into the search box. When a search has been made make the following request to PureClarity using the Dynamic Zone Loading method passing in the search term:
- In the callback event update the appropriate element on your page with the HTML content from PureClarity. This is likely to be a drop down box under the search input.
