import * as xo from '@attraqt/xo-js';
xo.init({
activity: {
trackerKey: 'YOUR_TRACKER_KEY',
region: 'WEBSITE_REGION' // optional, set to EU by default
},
search: {
token: 'SEARCH_API_TOKEN'
}
});
xo.activity.send({
action: 'view',
target: {
product: 'YOUR_PRODUCT_ID'
}
});
xo.search.query('T-Shirt', {
offset: 10,
limit: 30,
filter: 'price < 50'
});
xo.search.suggest('T-Shirt', {
filter: 'price < 50',
groupBy: {
attribute: 'kind',
count: 10,
values: ['product', 'shops', 'ads']
}
});
xo.search.autocomplete('T-Shirt', {
numberOfSuggestions: 5
});