Overview
Instructions to send to Empathy clicks on any product in the product category page using the Javascript Tagging Library.
Step-by-step guide
Clicks in any product of the product category page should be sent to Empathy using the function trackBrowseProduct.
trackBrowseProduct
trackBrowseProduct(categoryid, page, position, productid, title, url, scope, options, callback)
Parameters
Parameter | Description | Data Type | Mandatory |
---|---|---|---|
categoryid | The ID of the Product Category Page where the product is selected | String | Yes |
page | The page number | Integer | Yes |
position | The position of the product selected on Product Category Page. | Integer | No* |
productid | The product ID of the selected product. | String | No* |
title | The product selected title | String | Yes |
url | Destination URL, for example product detail page | String | Yes |
scope | This parameter is used for separate analytic data between two or more different scenarios | String | No* |
options | Object that may contain information about filters and other required data | Object | No |
callback | Function that will be executed after sending data | Function | No |
*This parameters are not mandatory for the service but necessary for the statistics |
The options object should contains additional parameters not passed as parameters but also necessary such as language. Also section, userID and sessionID that must be included if they're available or required:
{ lang: LANGUAGUE, section: SECTION, user: USER_ID, session: SESSION_ID }
The callback function receives an object with the following content:
{ page: page, productId: productid, categoryId: categoryid, position: position, title:title, url:url, scope: scope, follow: false }
The callback also receives the parameter lang, user, session and the other params sent in options.
NOTE: The values for scope and options parameters will be provided by the EmpathyBroker Team.
Code samples
<a href="http://MY_PRODUCT_URL.com" title="My product title" prodID="My product ID" class="myLink">My Test Link</a>
/** * 1 -> Capture click on the desired product * 2 -> Avoid default action (redirect to destination url) * 3 -> Execute trackClick function with the desired callback (including url redirection) */ jQuery('a#myLink').click(function(){ event.preventDefault(); var myURL = this.href; var title = this.title; var prodID = this.prodID; empathyTAG.trackBrowseProduct("My_category_ID", 1, 3, this.prodID, this.title, this.href, , {lang:'en'}, function(){ //Add your code here document.location.href = myURL; }); });
Related articles
-
Javascript Tagging Library: Track Conversion Clicks (Empathy Knowledge Base)
-
Javascript Tagging Library: Track Wishlist Clicks (Empathy Knowledge Base)
-
Using Javascript Tagging Library - Deprecated (Empathy Knowledge Base)
-
Javascript Tagging Library: Track Add2Cart Clicks (Empathy Knowledge Base)
-
Javascript Tagging Library: Track Clicks (Empathy Knowledge Base)
-
Javascript Tagging Library: Track Queries (Empathy Knowledge Base)
-
Using Javascript Tagging Library - 1.3 - Deprecated (Empathy Knowledge Base)
-
Javascript Tagging Library: Track Checkout (Empathy Knowledge Base)
-
Javascript Tagging Library - Track Search (Empathy Knowledge Base)
-
Javascript Tagging Library - Track Browse (Empathy Knowledge Base)
-
Javascript Tagging Library: Track Browse Add2Cart (Empathy Knowledge Base)
-
Javascript Tagging Library: Track Browse Category (Empathy Knowledge Base)
-
Javascript Tagging Library: Track Query (Empathy Knowledge Base)
-
Javascript Tagging Library: Track Browse Product (Empathy Knowledge Base)
-
Javascript Tagging Library: Track Wishlist (Empathy Knowledge Base)