Skip to main content

Custom Events Integration

Embed code automatically tracks all out-of-the box events. Some events, however require manual integration by invoking the JavaScript function sendVueAnalyticsEvent through your code.

This is applicable if you use APIs for Recommendations and script for Events tracking (Mixed mode of Integration). You need to integrate with the Javascript functions to track events from carousels rendered with the Vue.ai recommendations.

For the description of out-of-the box events and the ones that need manual integration, please refer the following table:

EventDescriptionRequires manual integration
pageViewLoad of any pageno
addToCartWhen user adds an item to the cart by clicking on "Add to cart" button or any other equivalent actionsometimes (when tracking events from carousels rendered with the Vue.ai recommendations)
removeFromCartWhen user removed an item from the cart by clicking on "Remove from cart" button or any other equivalent actionsometimes (when tracking events from carousels rendered with the Vue.ai recommendations)
orderConfirmationWhen user has completed the purchase on order confirmation pageno
addToWishlistWhen user adds an item to the wishlist by clicking on "Add to wishlist" button or any other equivalent actionsometimes (when tracking events from carousels rendered with the Vue.ai recommendations)
removeFromWishlistWhen user removes an item from the wishlist by clicking on "Remove from wishlist" button or any other equivalent actionsometimes (when tracking events from carousels rendered with the Vue.ai recommendations)
socialShareWhen user shares the product in social medium by clicking on "Share" button or any other equivalent actionno
placeOrderFired on click of the place order / buy now button or any equivalent eventsometimes (when tracking events from carousels rendered with the Vue.ai recommendations)
recommendationViewOn load of the recommendations in any pageyes
recommendedProductViewWhen user clicks on any of the recommendationsyes
leftSwipeWhen user tries to see more recommendations using swipe or any other equivalent actionyes
rightSwipeWhen user tries to see more recommendations using swipe or any other equivalent actionyes

Javascript Function#

Call the function sendVueAnalyticsEvent to track custom events#

Request Parameters:#

ParamDescriptionType
nameIndicates name of the event. Refer event names from the tablestring
actionIndicates action of the event. Refer event actions from the tablestring
non_interactionIndicates action triggered by interaction or otherwise. Allowed Values: 'true', 'false'string
metaData -> module_idIndicates the ID of the module that is rendered in recommendationstring
metaData -> module_nameIndicates the name of the module that is rendered in recommendationstring
metaData -> strategy_idIndicates the ID of the strategy that is rendered in recommendationstring
metaData -> module_behaviourIndicates how the recommendation is rendered. Allowed Values: inline, popupstring
metaData -> recos_servedIndicate the number of products that is recommendedinteger
metaData -> pos_of_recoPosition of the product that was clicked in the recommendationinteger
metaData -> product_list -> product_idwhen name = recommendationView, indicates the unique product identifier of the product for which recommendations are viewed.when name = recommendedProductView, indicates the unique product identifier of the product which was clicked on.string
metaData -> product_list -> priceIndicates the price of the product that the user saw as recommendationstring
metaData -> product_list -> quantityIndicates the quantity of the product that the user saw as recommendationinteger
metaData -> referrer_product -> product_idIndicates the unique product identifier of the product which is available in the page from which the recommended product was clicked onstring
metaData -> referrer_product -> priceIndicates the price of the product which is available in the page from which the recommended product was clicked onstring
metaData -> order_byIndicates the sort order applied on the Product Listing page. Sort section describes this in detailJSON object
metaData -> filtersIndicates the filters applied on the Product Listing page. Filters section describes this in detailarray of JSON objects

Example Code#

Event - recommendationView#

const eventData = {   name: 'recommendationView',   action: 'pageView',   non_interaction: module.behaviour === 'inline' ? 'true' : 'false',   metaData: {     module_id: "23",     module_name: "Inspired by Browsing History",     module_behaviour: "inline"/"popup",     recos_served: 8,     product_list: [{        product_id: "p1234",        price: "3000.00",        quantity: 1    }]   } };
 window.vuex.v1.sendVueAnalyticsEvent(eventData);

Event - recommendedProductView#

Note:

The product_list should be the product that your customer is clicking on the recommendation widget. There should be only one element in this parameter.

Note:

The referrer_product should be the product that is in view in the Product Detail Page or the product for which recommendations are displayed. In pages where there is no source product present, this field can be ignored.

 const eventData = {   name: 'recommendedProductView',   action: 'click',   non_interaction: 'false',   metaData: {     strategy_id: "234",     module_id: "23",     module_name: "Style it With",     module_behaviour: "popup",     product_list: [{        product_id: "p2345",        price: "250.00"     }],     referrer_product: {        product_id: "p1234",        price: "3000.00"     },     pos_of_reco: 3   } };
 window.vuex.v1.sendVueAnalyticsEvent(eventData);

Event - leftSwipe#

 const eventData = {   name: "leftSwipe",   action: 'click',   non_interaction: 'false',   metaData: {       module_id: "23",       module_name: "Style it With",       module_behaviour: "popup",  }};

Event - rightSwipe#


 const eventData = {   name: "rightSwipe",   action: 'click',   non_interaction: 'false',   metaData: {       module_id: "23",       module_name: "Style it With",       module_behaviour: "popup",  }};
window.vuex.v1.sendVueAnalyticsEvent(eventData);

Event - addToCart#


 const eventData = {   name: 'addToCart',   action: 'click',   non_interaction: 'false',   metaData: {     strategy_id: "234",     module_id: "23",     module_name: "Style it With",     module_behaviour: "popup",     product_list: [{         product_id: "p2345",         price: "250.00"     }],     referrer_product: {         product_id: "p1234",         price: "3000.00"     },     pos_of_reco: 3   } };
window.vuex.v1.sendVueAnalyticsEvent(eventData);

Event - removeFromCart#


 const eventData = {   name: 'removeFromCart',   action: 'click',   non_interaction: 'false',   metaData: {     strategy_id: "234",     module_id: "23",     module_name: "Style it With",     module_behaviour: "popup",     product_list: [{         product_id: "p2345",         price: "250.00"     }],     referrer_product: {         product_id: "p1234",         price: "3000.00"     },     pos_of_reco: 3   } };
window.vuex.v1.sendVueAnalyticsEvent(eventData);

Event - addToWishlist#


 const eventData = {   name: 'addToWishlist',   action: 'click',   non_interaction: 'false',   metaData: {     strategy_id: "234",     module_id: "23",     module_name: "Style it With",     module_behaviour: "popup",     product_list: [{         product_id: "p2345",         price: "250.00"     }],     referrer_product: {         product_id: "p1234",         price: "3000.00"     },     pos_of_reco: 3   } };
window.vuex.v1.sendVueAnalyticsEvent(eventData);

Event - removeFromWishlist#


 const eventData = {   name: 'removeFromWishlist',   action: 'click',   non_interaction: 'false',   metaData: {     strategy_id: "234",     module_id: "23",     module_name: "Style it With",     module_behaviour: "popup",     product_list: [{         product_id: "p2345",         price: "250.00"     }],     referrer_product: {         product_id: "p1234",         price: "3000.00"     },     pos_of_reco: 3   } };
window.vuex.v1.sendVueAnalyticsEvent(eventData);

Event - placeOrder#


 const eventData = {   name: 'placeOrder',   action: 'click',   non_interaction: 'false',   metaData: {     strategy_id: "234",     module_id: "23",     module_name: "Style it With",     module_behaviour: "popup",     product_list: [{         product_id: "p2345",         price: "250.00"     }],     referrer_product: {         product_id: "p1234",         price: "3000.00"     },     pos_of_reco: 3   } };
window.vuex.v1.sendVueAnalyticsEvent(eventData);