Toys Inc. has a search page with live product filtering on a set of predefined categories. For example:
- Brand
- Gender
- Age
- Price
- Range
Since there are no page reloads between each search result we need to use event or asynchronous tracking. This is done in the following way:
$netminers.push(['postPageView', 'Frontpage/Products/Search By Category']);
If a visitor selects the following filters...
- Brand=LEGO Friends
- Brand=LEGO Friends
- Gender=Female
- Age=Price Range=3 (Could be 3 of 5 in a scale from cheap to expensive)
We would then construct the following JSON:
// No need to send long identifiers like 'Price Range' every time. 'Price Range' every time. // We use abbreviations for each JSON variable name we send. // Variable names MUST be individually unique across all JSON objects We send. { 'bra': 'LEGO Friends', 'gen': 'Female', 'age': '8-10', 'pri': '3' }
To send the new search (asynchronous pageview) with the filter JSON object, we'll do the following:
$netminers.push([ 'postPageView', 'Frontpage/Products/Search By Category', { 'bra': 'LEGO Friends', 'gen': 'Female', 'age': '8-10', 'pri': '3' } ]);
If a visitor selects more than one brand - e.g. both "LEGO Friends" and "Barbie" - then you need to send two pageviews, each with a specific JSON configuration. For example:
// Send the first pageview, with LEGO as the brand $netminers.push([ 'postPageView', 'Frontpage/Products/Search By Category', { 'bra': 'LEGO Friends', 'gen': 'Female', 'age': '8-10', 'pri': '3' } ]); // Send the second pageview, with Barbie as the brand $netminers.push([ 'postPageView', 'Frontpage/Products/Search By Category', { 'bra': 'Barbie', 'gen': 'Female', 'age': '8-10', 'pri': '3' } ]);