Granify.trackProduct is used to notify Granify about the products on a page. It should be called with an array of product objects with all variations of items on that page. For example, if a shirt had different colors or sizes, the method call should include a product entry for every combination of shirt color and size.
Placement
Granify.trackProduct should be called as soon as possible after trackPageView on a product page.
Usage
For usage information, see the Granify.trackProduct documentation.
Example
// Example with two products/variants on a page
Granify('trackProduct', [{
sku: '1234567',
product_id: '1234',
title: 'Gritty Mask',
price: 200.00,
regular_price: 200.00,
image: 'https://example.com/example.jpg',
in_stock: 1,
ratings: 4.5,
number_of_reviews: 10,
category: 'Clothing',
sub_category: 'Masks',
color: 'orange',
size: 'large',
}, {
sku: '56789123',
product_id: '5678',
title: 'Gritty Jersey',
price: 150.00,
regular_price: 200.00,
image: 'https://example.com/example2.jpg',
in_stock: 1,
ratings: 4.5,
number_of_reviews: 10,
category: 'Clothing',
sub_category: 'Shirts',
color: 'orange',
size: 'large',
}]);