Javascript Tagging Library: Track Browse Product


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(categoryid, page, position, productid, title, url, options, callback)


ParameterDescriptionData TypeMandatory
categoryidThe ID of the Product Category Page where the product is selectedStringYes
pageThe page numberInteger


positionThe position of the product selected on Product Category Page.IntegerNo*
productidThe product ID of the selected product.StringNo*
titleThe product selected titleString


urlDestination URL, for example product detail pageStringYes
optionsObject that may contain information about filters and other required dataObjectNo*
callbackFunction that will be executed after sending dataFunctionNo

*This parameters are not mandatory for the service but necessary for the statistics


The options object should contains additional parameters not passed as parameters in function call:

	scope: SCOPE,
	section: SECTION,
	user: USER_ID,
	session: SESSION_ID
ParameterDescriptionData TypeMandatory
langLanguage identifier (es, en...)StringNo
scopeScope identifier (desktop, mobile, android app, iOS app...)StringNo
sectionSection value if it is required for the projectStringNo
userUserID used for user based servicesString*No
sessionSessionID used for user based servicesStringNo

*UserID should be an UUID identifier.

NOTE: The values for scope and lang will be provided by the Empathy Team.

The callback function receives an object with the following content. Also options parameters are included:

    page: page,
	productId: productid,
	categoryId: categoryid,
	position: position,
    follow: false

Code samples

<a href="" 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)
   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',scope:'testscope'}, function(){
   		//Add your code here
   		document.location.href = myURL;