...
...
...
...
...
...
...
...
Overview
Instructions to send browse information using the Javascript Tagging Library.
Step-by-step guide
Browsing data can be sent to Empathy using the trackBrowseCategory function including the parameters detailed below. This function should be executed each time a product category page is loaded.
Code Block | ||
---|---|---|
| ||
trackBrowseCategory( categoryid, results, page, options, callback) |
Parameters
Parameter | Description | Data Type | Mandatory |
---|---|---|---|
categoryid | The ID of the Product Category Page loaded | String | Yes |
results | Number of results displayed in the category | Integer | Yes |
page | The page number | Integer | Yes |
options | Object that may contain information about filters and other data like session and userID | 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 |
Options
The options object should contains additional parameters not passed as parameters in function call:
...
Code Block | ||
---|---|---|
| ||
{ categoryId: categoryid, totalHits: results, page: page, scope: scope, referrer: document.referrer } |
Code samples
Normal Usage
Specifying a callback parameter
Code Block | ||
---|---|---|
| ||
/** * This example suppose that the provided scope is 'testscope' and the parameter to be included in the options parameter is the lang * parameter with value 'en' . UserID and SessionID are also included. **/ var options = { lang:'en', session: 'q1w2e3r4t5y6', scope: 'testscope', user: 'u1s2e3r', } empathyTAG.trackBrowseCategory('myCatID', 48, 1, options,function(responseData){ alert('test'); }); |
Without a callback (No functions will be executed after tracking the data)
Code Block | ||
---|---|---|
| ||
/** * This example suppose that the provided scope is 'testscope' and the parameter to be included in the options parameter is the lang * parameter with value 'en' . UserID and SessionID are also included. **/ var options = { lang:'en', session: 'q1w2e3r4t5y6', scope: 'testscope', user: 'u1s2e3r', } empathyTAG.trackBrowseCategory('myCatID', 48, 1, options); |
Best practices
In most of the cases, you should implement one of these solutions to prevent receiving partial queries:
...
Blank queries: Do not send a category without characters. Usually when users click in search button without write nothing in search box.
In this case be careful to not send the placeholder text (i.e. "Search...")
Related articles
Filter by label (Content by label) | ||
---|---|---|
|