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.
Click item event arguments:
type
required ('click-item'): Click item event type.
request.item_id
required (string): Id of item, which user clicked.
request.variant_item_id
optional (string): Id of item variant.
request.rid
optional (string): Id of request, where user clicked on item.
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.
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.total_discount
optional (number): Total discount of the purchase.
request.total_tax
optional (number): Total tax of the purchase.
request.shipping
optional (number): Total shipping of the purchase.
request.line_items
required (line_item[]): Items in cart.
request.affiliation
optional (string): Affiliation of the purchase.
Update cart event arguments:
type
required ('update-cart'): Update cart event type.
request.line_items
required (line_item[]): Items in cart.
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.variant_item_id
optional (string): Id of item variant.
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.
View page event arguments:
type
required ('view-page'): View page event type.
request.item_id
optional (string): Id of item. Only for product pages.
request.variant_item_id
optional (string): Id of item variant.
Types:
line_item.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.
line_item.variant_item_id
optional (string): Id of item variant.
Examples of usage:
// Click suggestion event
var request = {
rid: '892',
suggestion: 'White t-shirts'
};
client.sendEvent('click-suggestion', request);
// Click item event
var request = {
rid: '892',
item_id: '9842'
};
client.sendEvent('click-item', request);
// Redirect event
var request = {
rid: '892',
suggestion: '9842'
};
client.sendEvent('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.sendEvent('purchase', request);
// Update cart event
var request = {
line_items: [{
item_id: '5028',
unit_price: 394.1,
quantity: 2
}]
};
client.sendEvent('update-cart', request);
// Add to cart event
var request = {
item_id: '5720',
rid: '72046',
quantity: 1,
};
client.sendEvent('add-to-cart', request);
// View page event
var request = {
item_id: '8572'
};
client.sendEvent('view-page', request);