Path

7x / documentation / extensions / ez publish extensions / ez recommendation / retrieving recommendations


Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Retrieving Recommendations

Retrieving recommendations

In order to get recommendations, a custom tag needs to be inserted in an article. This can be done in the editor view of an article by simply adding it in the WYSIWIG Editor.

While editing an item click on “insert custom tag”

 

eZ Recommender Insert Custom Tag

and select “recommendations” from the option-box.

eZ Recommender Insert Custom Tag

Select the corresponding recommendation scenario (see also under https://admin.yoochoose.net) and if you want it to be rendered inside the article or as a flyout.

eZ Recommender Insert Custom Tag

The following placeholder should appear in the editor window

eZ Recommender Insert Custom Tag

After publishing and reloading the page you will see recommendations if there’s enough tracking events available.

eZ Recommender Insert Custom Tag

If you want to customize the embedding of recommendations you can also follow these steps:

Include the following code wherever you want to see the recommendations

{include uri='design:content/recommendations.tpl'  node=$node scenario='top_clicked' limit=3 category_based=false() track_rendered_items=true() create_clickrecommended_event=true()}

As an example, we included the code in our full view template of ´articles for recommendation´ between the star rating and the related content.

...
<div class="attribute-star-rating">
&nbsp;&nbsp; {attribute_view_gui attribute=$node.data_map.star_rating}
</div>
{* Start of eZ Recommendation service *}
<div class="attribute-recommendations">
<h1>{"Also clicked articles"}</h1>
{include uri='design:content/recommendations.tpl'&nbsp; node=$node scenario='also_clicked_article' limit=3 category_based=false() track_rendered_items=true() create_clickrecommended_event=true()}
</div>
{* End of eZ Recommendation service *}
&nbsp;&nbsp; {include uri='design:parts/related_content.tpl'}
...

After reloading  the page we see the following:

eZ Recommender Insert Custom Tag

The top of the above screenshot shows the article full view followed by a star rating and recommendations from the eZ Recommendation service.

To analyze the recommendation workflow in more detail, we check again the latest entries in <eZ publish root directory>/var/log/debug.log.

We start with the request for recommendations:

debug.log:
[ Sep 17 2011 16:20:23 ] [ezyoochoose] Trying request reco.yoochoose.net/ebl/<strong><CustomerID></strong>/top_clicked.json?itemid=246&numrecs=3&itemtypeid=2
[ Sep 17 2011 16:20:24 ] [ezyoochoose] Sending request reco.yoochoose.net/ebl/<strong><CustomerID></strong>/top_clicked.json?itemid=246&numrecs=3&itemtypeid=2
[ Sep 17 2011 16:20:24 ] [ezyoochoose] Received answer 'HTTP/1.1 200 OK
...

If the installation is working properly and recommendations are available you will also see an answer in the following form:

[ Nov 17 2011 18:59:29 ] [ezrecommendation] Received recommendations
{"recommendationResponseList":[{"reason":"CF_I2I_CLICK (context: ITEM(s))","itemType":2,"itemId":179,"relevance" :93},{"reason":"CF_I2I_CLICK (context: ITEM(s))", "itemType":2,"itemId":175,"relevance":91},{"reason": "CF_I2I_CLICK (context:ITEM(s))","itemType":2, "itemId":177,"relevance":76}]}'...&nbsp;&nbsp;

Scrolling down you will see tracking events showing that some of the recommendations have been rendered:

[ Nov 17 2011 18:59:29 ] [ezrecommendation] Sending request event.yoochoose.net/news/mycustomerID/rendered/mycookie/2/179,175,177

Andrea Melo (30/05/2012 10:30 am)

Andrea Melo (30/05/2012 2:18 pm)


Comments

There are no comments.