Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #349797

    Hello,

    I found some posts and have successfully added event tracking to buttons on the site.

    But I am unable to add the event tracking to buttons that are in my layerslider.
    When I try to add custom_class=’ga-de-slider-sd-quote’
    the whole button disappears

    How do I add Google Event Tracking to a button in the Layer Slider?

    I have added the following to functions.php
    add_theme_support(‘avia_template_builder_custom_css’);

    and I added the following in the theme Google Analytics Tracking Code

    <script>
    (function($){
    $(window).load(function() {
    $(‘.ga-de-about-portfolio a’).on(‘click’, function() {
    ga(‘send’, ‘event’, ‘button’, ‘click’, ‘ga-de-about-portfolio’);
    });
    $(‘.ga-de-blog-widget-quote a’).on(‘click’, function() {
    ga(‘send’, ‘event’, ‘button’, ‘click’, ‘ga-de-blog-widget-quote’);
    });
    $(‘.ga-de-down-brochure a’).on(‘click’, function() {
    ga(‘send’, ‘event’, ‘button’, ‘click’, ‘ga-de-down-brochure’);
    });
    $(‘.ga-de-slide-sdisc-quote a’).on(‘click’, function() {
    ga(‘send’, ‘event’, ‘button’, ‘click’, ‘ga-de-slide-sdisc-quote’);
    });
    });
    })(jQuery);
    </script>

    #349897

    Hi!

    If that doesn’t work you can always set a custom class to the layer instead – http://screencast.com/t/qoLjcrpp

    Cheers!
    Josue

    #350233

    Hello, I did try that too. But it does not work, the button appears okay, but no tracking stats show up.

    #350293

    Hi,

    Can you post the link to the website in question (+ the code you are using) please?

    Regards,
    Josue

    #350357

    the site is: http://gemcovalve.com/
    the layer slider has a background image and a layer with short code button
    [av_button label=' Request Quote' link='manually,/spec-quote/' link_target='' color='orange' custom_bg='#444444' custom_font='#ffffff' size='large' position='right' icon_select='yes' icon='12']

    When i tried to add custom_class=’ga-de-slide-sdisc-quote’ in the button – it breaks and no button displays at all.
    [av_button label=' Request Quote' link='manually,/spec-quote/' link_target='' color='orange' custom_bg='#444444' custom_font='#ffffff' size='large' position='right' icon_select='yes' icon='12' custom_class='ga-de-slide-sdisc-quote']

    I removed custom class from button and added: ga-de-slide-sdisc-quote
    to the attributes/classes in the layer slider per your last instruction. But no events are triggered.

    On the home page I have a promo box with a button where I added custom_class and the event tracking works.
    ga-de-home-cta-quote

    Thank you for your help

    #350577

    Hi!

    Yeah it seems the class is never getting applied, try targeting the button via the target of it:

    $('a[href="/spec-quote/"]').on('click', function() {
       ga('send', 'event', 'slide', 'click', 'ga-de-slide-sdisc-quote');
    });

    Regards,
    Josue

    #350790

    I tried your suggestion, but still no joy. Tried a few other things – still cannot get it to work. Any other ideas?
    thanks

    #351090

    Hi!

    Are you re-setting WP-Super-Cache on each try? your javascript code seems unchanged on my end.

    Cheers!
    Josue

    #351117

    Yes – works now- Thanks!
    I thought I deleted cache – but you were right the js wasn’t updated. Sometimes the cache is stubborn.

    #351134

    You are welcome, glad to help :)

    Regards,
    Josue

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.