Analytics

If you have google analytics embedded on your page, the widget will publish events/pageviews that occur within it to your analytics account–including ecommerce transactions. The majority of clickable/actionable elements in the widget have some sort of pageview/event attched to them.

If you wish to integrate a custom analytics engine, you can easily do so by subscribing to the onEvent function. The relevant keys to subscribe on are detailed below–

PIO.config({
    fns:{
        onEvent:function(key, val){
            if(key==="analytics-pageview"){
                // when a user switches to another page/section
                // similar to section-init, but makes it extra easy
                // to publish to custom analytics engines
                // val is page, title
                //
                // note that publishing this info to GA is turned on by default
                console.log("page view occurred",val.page,val.title);
            } else if(key==="analytics-event"){
                // when a specific tracking event occurs in the widget
                // feel free to suggest events if you want them added
                // mostly we use pageviews for data currently
                //
                // note that publishing this info to GA is turned on by default
            } else if(key==="analytics-addTransaction"){
                // this and the next 2 events are for GA Ecommerce tracking
                // the data and the flow is exactly as described here:
                // https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
                //
                // note that publishing this info to GA is turned on by default
            } else if(key==="analytics-send"){

            } else if(key==="analytics-addItem"){

            } else if(key==="onOrderSubmit"){
                // contains data similar to analytics ecommerce events
                // == full order data
            }
        }
    }
});