Follow

Javascript Click Tracking

To track the clicks that are made on a product of a recommender, you must use the following function every time someone click on a product: 

BrainSINSTracker.clickId( URL, ID);

URL: link of the product which you should be redirected when you click with our parameters.

  • URL Parameters:

    • idRecommendation (mandatory): composed by the ID of the recommender and ID of the product in this form: idRecommender-idProduct.
      Hardcoded example: idRecommendation=5-421
    • idPrevPage (optional)represent the previous page where the user was before the redirection. Is good to use it in case you have numeric identifiers for the pages in your web.
      Hardcoded example: idPrevPage=6814 

ID: the ID of the clicked product.

NOTE: URL and ID can be taken from the recommendation response.

NOTE2: take in consideration that the clickId function redirect to an url without our params so it does not affect to your SEO

This function can also be used within the HTML of the recommenders by an onclick. This is an example using the HTML code of one of our default recommenders:

<tr>
<td class="RecSINS-W-ItemsTD">
<div>
<div class="RecSINS-W-ItemsImage">
<a href="${url}" onclick="BrainSINSTracker.clickId('${url}','${id}');return false;">
<img class="RecSINS-W-ItemsImage" src=${image} border="0">
</a>
</div>
<div class="RecSINS-W-ItemsLine1" id="ItemsLine1">
<a href="${url}" onclick="BrainSINSTracker.clickId('${url}','${id}');return false;">${name}</a>
</div>
<div class="RecSINS-W-ItemsLine2">${price}</div>
</div>
</td>
</tr>

Now, the same example with hardcoded url: 

<tr>
<td class="RecSINS-W-ItemsTD">
<div>
<div class="RecSINS-W-ItemsImage">
<a href="http://catalog.brainsins.com/default/catalog/product/id/28984/toalla-gris/?idRecommendation=1-28984&idPrevPage=8623" onclick="BrainSINSTracker.clickId('http://catalog.brainsins.com/default/catalog/product/id/28984/toalla-gris/?idRecommendation=1-28984&idPrevPage=8623','28984');return false;">
<img class="RecSINS-W-ItemsImage" src=${image} border="0">
</a>
</div>
<div class="RecSINS-W-ItemsLine1" id="ItemsLine1">
<a href="http://catalog.brainsins.com/default/catalog/product/id/28984/toalla-gris/?idRecommendation=1-28984&idPrevPage=8623" onclick="BrainSINSTracker.clickId('http://catalog.brainsins.com/default/catalog/product/id/28984/toalla-gris/?idRecommendation=1-28984&idPrevPage=8623','28984');return false;">${name}</a>
</div>
<div class="RecSINS-W-ItemsLine2">${price}</div>
</div>
</td>
</tr>

If you are modifying the style of the recommender in our advanced editor and by error you delete this onclick do not worry, you can recover the function by clicking on Captura.PNG  on top left.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk