GroupBy Tracking Client
This can be installed via npm with npm install --save gb-tracker-client
Or it can be directly included from our CDN using:
<script src="https://cdn.groupbyinc.com/TBD/gb-tracker.js"></scipt>
Including it directly from the CDN will create the global variable
_GbTracker
with the same API as below.
API
const _GbTracker = require('gb-tracker-client');
const gbTracker = new _GbTracker('customerId', 'area');
gbTracker.setVisitor('visitorId', 'sessionId');
gbTracker.sendAddToBasketEvent({
product: {
id: 'asdfasd',
title: 'super boat',
price: 100.21,
qty: 20,
collection: 'testcollection',
category: 'boats',
sku: 'asdfasf98',
margin: 0.81
}
});
gbTracker.sendOrderEvent({
products: [
{
id: 'asdfasd',
title: 'super boat',
price: 100.21,
qty: 20,
collection: 'testcollection',
category: 'boats',
sku: 'asdfasf98',
margin: 0.81
},
{
id: 'asdfasd',
title: 'super boat',
price: 100.21,
qty: 20,
collection: 'testcollection',
category: 'boats',
sku: 'asdfasf98',
margin: 0.123
}
]
});
gbTracker.sendSearchEvent({
search: {
totalRecordCount: 10,
recordEnd: 10,
recordStart: 5,
refinements: [
{
name: 'refined 1',
value: 'refinedValue'
}
],
origin: {
recommendations: false,
dym: false,
sayt: false,
search: true
},
searchTerm: 'searchy searchface',
searchResponse: {}
}
});
gbTracker.sendViewProductEvent({
product: {
id: 'asdfasd',
title: 'super boat',
price: 100.21,
collection: 'testcollection',
category: 'boats',
sku: 'asdfasf98',
margin: 0.81
}
});