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.

'Click recommend'-event

‘Click recommend'-event

This event is of outmost importance if you want to measure the acceptance of your recommendations. In the statistics we use the ratio of ´Click recommended´-events” divided by the total number of recommendation calls to calculate the so-called conversion rate:

conversion rate = # of ´click recommended´-events/ # recommendation calls

The ‘click recommended’ event is sent by default, if a recommended object was clicked.

If you want to customize or use it differently, you can also add it manually. All you need to do is the following:

1)    When you retrieve recommendations (see chapter ´The get recommendation call´) you set the parameter

create_clickrecommended_event=true()

2) The following code must be included into an <a>-tag of the templates that you use to show the recommendations (usually the line-view):

{if eq($create_clickrecommended_event, true())}
 {generate_common_event($node, 'clickrecommended')}{/if}

 

Example (article line view):

<div class="content-view-line">
<div class="class-article float-break">
<h2><a {if eq($create_clickrecommended_event, true())}
{generate_common_event($node, 'clickrecommended')}{/if}
href={$node.url_alias|ezurl}>{$node.data_map.title.content|wash}
 </a></h2>
...

3) In many cases you include an image into the view. In this case you have to inherit the create_clickrecommended_event variable and the node to the corresponding image.tpl.

Example (article line view):


{section show=$node.data_map.image.has_content}
<div class="attribute-image">
{attribute_view_gui image_class=articlethumbnail
href=$node.url_alias|ezurl
attribute=$node.data_map.image
create_clickrecommended_event=
$create_clickrecommended_event ycnode=$node}
</div>
{/section}
...

4) Finally you have to modify your override of the ´ezimage.tpl´ in an <a>-tag similar to step 2) and include the code to generate the ´click recommended´-event. Note that we used the additional variable ´ycnode´ to inherit the node.

Example (ezimage override):

...
{if $href} <a
 {if eq($create_clickrecommended_event, true())}
 {generate_common_event($ycnode, 'clickrecommended')}{/if}
 href={$href}
 {if and( is_set( $link_class ), $link_class )}
 class="{$link_class}"{/if}
 {if and( is_set( $link_id ), $link_id )}
 id="{$link_id}"{/if}
 {if $target} target="{$target}"{/if}
 {if and( is_set( $link_title ), $link_title )} &nbsp;&nbsp; id="{$link_title|wash}"{/if}>
 {/if}
...

Andrea Melo (29/05/2012 3:45 pm)

Andrea Melo (31/05/2012 1:44 pm)


Comments

There are no comments.