Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1213608
    KierynM
    Participant

    Hi guys,
    I know that putting in universal google analytics is not within the scope of your support but I am having a real problem tracking an event. So far I have managed to track buttons and destination pages. I want to track however how many times someone views a youtube video I have. The video is in a lightbox that is within a text element. The code I have used is as follows:

    [image class=”intro” src=”http://www.helpingtradiesonline.com/wp-content/uploads/2016/04/Screen-Shot-2016-04-08-at-1.45.03-pm-e1460114092958.png” link=”true” href=”https://www.youtube.com/embed/R4WAVPywPcI” lightbox_video=”true”]
    [lightbox selector=”.intro”]

    I added what I think is the correct code to track when the element is clicked. The code I have added is:

    onClick=”ga(‘send’, ‘event’, ‘Welcome Video’, ‘Play’, ‘Home Page’);”

    This means the entire code i have in the text element is:

    [image class=”intro” src=”http://www.helpingtradiesonline.com/wp-content/uploads/2016/04/Screen-Shot-2016-04-08-at-1.45.03-pm-e1460114092958.png” link=”true” href=”https://www.youtube.com/embed/R4WAVPywPcI” onClick=”ga(‘send’, ‘event’, ‘Welcome Video’, ‘Play’, ‘Home Page’);” lightbox_video=”true”]
    [lightbox selector=”.intro”]

    I have made sure the event is also placed in on the google analytics side but nothing is being tracked. I am guessing there is something I am missing with regards to this element but I can’t figure it out so I bow to your knowledge and hope you can give me some direction. Is this because it is a lightbox?

    I really appreciate the help guys,
    Kiz

    #1213612
    KierynM
    Participant
    This reply has been marked as private.
    #1214147
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! Please edit your page and update the entire code you added in the text element. Please use this instead:

    
    <a class="x-img intro x-img-link" href="https://www.youtube.com/embed/R4WAVPywPcI" data-options="thumbnail: 'http://www.helpingtradiesonline.com/wp-content/uploads/2016/04/Screen-Shot-2016-04-08-at-1.45.03-pm-e1460114092958.png', width: 1080, height: 608" onClick="ga('send', 'event', 'Welcome Video', 'Play', 'Home Page');"><img src="http://www.helpingtradiesonline.com/wp-content/uploads/2016/04/Screen-Shot-2016-04-08-at-1.45.03-pm-e1460114092958.png"></a>
    [lightbox selector=".intro"]

    We would loved to know if this has work for you. Thank you.

    #1214260
    KierynM
    Participant

    Hi Rue,

    Your fix worked perfectly. Not only is the lightbox still functioning in the exact same way the analytics is now tracking when the element is clicked. What was I doing wrong if you don’t mind me asking (for future reference)?

    Really appreciate the help, you’re a superstar.

    Kind regards,
    Kiz

    #1214420
    Lely
    Moderator

    Hi Kiz,

    On your version, you’re using image shortcode. By default onClick event is not available on image. It is available on link tag <a></a>.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1213608 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>