开发者

How to incorporate Google Analytics Event Tracking with Anythingslider

I am looking for some clues on where to add Google Analytics Event Tracking to a page that has AnythingSlider installed. I have a slider that does not autoscroll and you have to click the navigation buttons for the slides to move. I wish to track these clicks. I would also like to track if a visitor clicks on a link within a slide.

I am wishing to use Google's InPage Analytics to track visitor click behavior and workout what items (images & phrases) catch the attention of the visitor in orde开发者_JAVA百科r to make better lead funnels.

I did try the Event tracking guide from Google before posting here, but I was unsure of where to pickup the navigation clicks from the slider.


add this to any a href in your html

  onClick="_gaq.push(['_trackEvent', 'Slider','Panelno:x', 'blah']);"


Untested (I'm about to do this myself) but the API suggests to me that I should use the onSlideComplete callback, e.g. (assuming you've set up the names of your panels in an array called pages).

onSlideComplete     : function(foo) {
    _gaq.push(['_trackEvent', 'Slider','Panelno:'+slider.currentPage, pages[index - 1]]);
}

EDIT: Be careful with onSlideComplete, it seems to fire off too often. Set a var to tell it not to refire, and reset the var with onSlideBegin.

onSlideBegin     : function(e, slider) {
    refire = 1;
},
onSlideComplete     : function(slider) {
    if (refire) {
        _gaq.push(['_trackEvent', 'Slider','Panelno:'+slider.currentPage, pages[slider.currentPage - 1]]);
        refire=0;
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜