This method has dynamic request
argument. It depends on provided event type
. See description below to get definitions of request
argument for every event type
.
Click suggestion event arguments:
type
required ('click-suggestion'): Click suggestion event type.
request.rid
required (string): Id of request, where user clicked on suggestion.
request.suggestion
required (string): Suggestion title.
request.user
optional (user): User object. Could be provided either at initialization or at request.
Click item event arguments:
type
required ('click-item'): Click item event type.
request.item_id
required (string): Id of item, which user clicked.
request.rid
optional (string): Id of request, where user clicked on item.
request.user
optional (user): User object. Could be provided either at initialization or at request.
Redirect event arguments:
type
required ('redirect'): Redirect event type.
request.rid
required (string): Id of request, where redirect was happened.
request.suggestion
required (string): Suggestion that leads to the redirection.
request.user
optional (user): User object. Could be provided either at initialization or at request.
Purchase event arguments:
type
required ('purchase'): Purchase event type.
request.order_id
required (string): Id of order.
request.currency
required (string): Currency of the purchase.
request.revenue
required (number): Total revenue of the purchase.
request.line_items
required (line_item[]): Items in cart.
request.affiliation
optional (string): Affiliation of the purchase.
request.user
optional (user): User object. Could be provided either at initialization or at request.
Update cart event arguments:
type
required ('update-cart'): Update cart event type.
request.line_items
required (line_item[]): Items in cart.
request.user
optional (user): User object. Could be provided either at initialization or at request.
Add to cart event arguments:
type
required ('add-to-cart'): Add to cart event type.
request.item_id
required (string): Id of item, added to cart.
request.rid
optional (string): Id of request, where add to cart button was clicked.
request.quantity
optional (number): Quantity of items, added to cart. Default - 1.
request.user
optional (user): User object. Could be provided either at initialization or at request.
View page event arguments:
type
required ('view-page'): View page event type.
request.url
required (string): Url of the page viewed.
request.ref
required (string): Referrer of the page.
request.width
required (number): Width of the customer's browser.
request.height
required (number): Height of the customer's browser.
request.item_id
optional (string): Id of item. Only for product pages.
request.user
optional (user): User object. Could be provided either at initialization or at request.
Types:
line_item.id
required (string): Id of item.
line_item.unit_price
required (string): Price of the product.
line_item.quantity
required (number): Quantity of items.
user.uid
required (string): Unique customer id.
user.sid
required (string): Session id.
user.email
optional (string): Customer email.
user.ip
optional (number): Customer ip.
user.ua
optional (string): Customer user agent.
user.lang
optional (string[]): Languages.
Examples of usage:
// Click suggestion event
var request = {
rid: '892',
suggestion: 'White t-shirts'
};
client.feedback('click-suggestion', request);
// Click item event
var request = {
rid: '892',
item_id: '9842'
};
client.feedback('click-item', request);
// Redirect event
var request = {
rid: '892',
suggestion: 'T-shirt'
};
client.feedback('redirect', request);
// Purchase event
var request = {
order_id: '451',
currency: 'usd',
revenue: 394.1,
line_items: [{
item_id: '5028',
unit_price: 394.1,
quantity: 2
}]
};
client.feedback('purchase', request);
// Update cart event
var request = {
line_items: [{
item_id: '5028',
unit_price: 394.1,
quantity: 2
}]
};
client.feedback('update-cart', request);
// Add to cart event
var request = {
item_id: '5720',
rid: '72046',
quantity: 1,
};
client.feedback('add-to-cart', request);
// View page event
var request = {
url: 'some-store.com',
ref: 'some-referrer.com',
width: 1366,
height: 768,
item_id: '8572'
};
client.feedback('view-page', request);