Javascript Tagging Library: Track Wishlist Clicks

Overview

Instructions to send "Wishlist" clicks information using the Javascript Tagging Library.

Step-by-step guide

Clicks on "Wishlist" button can be tracked the functions trackWishlist / trackWishlists.

trackWishlist

Use this function to send information when a user clicks on an "Add to Cart" button.

trackWishlist(terms, page, title, url, scope, options, callback)

Parameters

ParameterDescriptionData TypeMandatory
termsThe query typed by the userStringYes
pageThe page numberIntegerYes
titleThe product or result titleStringYes
urlDestination URL, for example product detail pageStringYes
scopeThis parameter is used for separate analytic data between two or more different scenariosStringNo*
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 callback function will receive an object with the following contents:

{
    page: page,
	q: terms,
	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.

NOTE: If you are setting up the trackWishlist function into the product detail page, terms and page values will be relative to the product situation into the results grid before being clicked by the user.

Code samples

Selectors using jQuery (you could use other frameworks to build the selectors)

empathyTAG.trackWishlist('test',1,'My product title','http://MY_PRODUCT_URL.com','testscope',{lang:'en'},function(){});

trackWishlists

Same behaviour as trackWishlist but allowing to track more than one "Add to cart" button.

trackWishlists(selectors, terms, page, title, scope, options, callback)

Parameters

ParameterDescriptionData TypeMandatory
selectorsOne or more selectors (using any framework you want) pointing to the html to be trackedArray of DOM selectorsYes
termsThe query typed by the userStringYes
pageThe page numberIntegerYes
scopeThis parameter is used for separate analytic data between two or more different scenariosStringNo*
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 callback function will receive an object with the following contents:

{
    page: page,
	q: terms,
	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

<input id="send" name="send" class="btn02_add" type="submit" value="Add to basket"/>

If your "Add to basket" button doesn't contain attributes like title or href you should you should modify your html code to store the title and the url of the product, you should add a sb-title and sb-url attributes to the "Add to basket" button.

<input id="send" name="send" class="btn02_add" sb-title="Your title here" sb-url="YourURLHere" type="submit" value="Add to basket"/>

Selectors using jQuery (you could use other frameworks to build the selectors)

var selectors = [jQuery('#send')];
empathyTAG.trackWishlists(selectors,'test',1,'testscope',{lang:'en'},function(responseData){});