Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1163639

    BradleyB
    Participant

    Hi,

    I have a video that is triggered by a play button in one of my revolution sliders.

    I want to track when people click on the play button in Google Analytics with Event Tracking. I have the following code for event tracking, but can’t figure out where to add it. Is this the right way to do it?

    onclick=“_gap.push([‘_trackEvent’,’videoplay’,’playvid’,’fixvid’]);"

    Any help would be greatly appreciated. Thanks so much! –

    #1163641

    BradleyB
    Participant
    This reply has been marked as private.
    #1164029

    Christopher
    Moderator
    #1164802

    BradleyB
    Participant
    This reply has been marked as private.
    #1165503

    Rad
    Moderator
    This reply has been marked as private.
    #1165531

    BradleyB
    Participant

    Amazing! Thank you so much!

    The event is now showing up in analytics. However, there is a problem. Adding this class has removed the lightbox styling. Now, when you press the play button, you are taken to a new page (http://treehouserecovery.com/wp-content/uploads/2016/08/Healthy2.mp4?autoplay=1) instead of the lightbox.

    I have disabled the class, because the page is live. Attached is an image of what it looks like before and after adding the class. Any ideas how to avoid this change? Thanks again!

    #1165889

    Rue Nel
    Moderator

    Hello There,

    Please update your shortcode and use this instead:

    
    [image src="http://thrcontent.com/wp-content/uploads/2016/04/play-btn-1.png" link="true" class="track-video-clicks" href="http://treehouserecovery.com/wp-content/uploads/2016/08/Healthy2.mp4?autoplay=1" lightbox_video="true"] [lightbox selector=".lightbox-video"]

    And then update the JS code as well;

    jQuery( '.track-video-clicks' ).on('click', function() {
    
    _gap.push(['_trackEvent','videoplay','playvid','fixvid']);
    
    } );

    Please let us know if this works out for you.

    #1166530

    BradleyB
    Participant
    This reply has been marked as private.
    #1167179

    Rad
    Moderator

    Hi there,

    It doesn’t remove styling, it loads the video on the same page. It’s like clicking a link and that replaces the page you’re currently viewing.

    Please change it to this

    [image src="http://thrcontent.com/wp-content/uploads/2016/04/play-btn-1.png" link="true" class="track-video-clicks" href="http://treehouserecovery.com/wp-content/uploads/2016/08/Healthy2.mp4?autoplay=1" lightbox_video="true"] [lightbox selector=".track-video-clicks"]

    Selector should always match.

    Thanks!

    #1167189

    BradleyB
    Participant
    This reply has been marked as private.
    #1167191

    BradleyB
    Participant

    Attached is the screenshot.

    #1167622

    Rad
    Moderator
    This reply has been marked as private.
    #1168331

    BradleyB
    Participant
    This reply has been marked as private.
    #1168908

    Rad
    Moderator

    Hi there,

    I see, it’s because of this

    jQuery( '.track-video-clicks' ).on('click', function() {
    
    _gap.push(['_trackEvent','videoplay','playvid','fixvid']);
    
    } );

    That code is okay, but, this assumes that you already have the google tracking library installed. It’s failing and affecting your lightbox since it’s calling for _gap that doesn’t exist. You can’t just use it anywhere, you should install the tracking library to where _gaq is dependent. It’s a form embed codes that you’ll need to add to your site https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApi_gaq

    It’s should be _gaq and not _gap, and you should follow the embed procedure according to your analytics setup.

    How about this,

    jQuery( '.track-video-clicks' ).on('click', function() {
    
    ga('send', 'event', 'Videos', 'play', 'fixvid');
    
    } );

    It correctly matches your currently embedded analytics ga().

    Hope this helps.

    #1169424

    BradleyB
    Participant

    Thank you so much!

    That code fixed the lightbox issue! However, now the event is not registering in Analytics. I used the ga(), which you said matches my embedded analytics. Any idea what could be wrong? Again, thank you so much for all of your help! It is GREATLY appreciated! –

    B