Tagged: Buttons, LayerSlider, Tracking
-
AuthorPosts
-
November 12, 2014 at 1:01 am #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 disappearsHow 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>November 12, 2014 at 6:50 am #349897Hi!
If that doesn’t work you can always set a custom class to the layer instead – http://screencast.com/t/qoLjcrpp
Cheers!
JosueNovember 12, 2014 at 7:11 pm #350233Hello, I did try that too. But it does not work, the button appears okay, but no tracking stats show up.
November 12, 2014 at 8:06 pm #350293Hi,
Can you post the link to the website in question (+ the code you are using) please?
Regards,
JosueNovember 12, 2014 at 9:37 pm #350357the 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-quoteThank you for your help
November 13, 2014 at 6:16 am #350577Hi!
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,
JosueNovember 13, 2014 at 5:44 pm #350790I tried your suggestion, but still no joy. Tried a few other things – still cannot get it to work. Any other ideas?
thanksNovember 14, 2014 at 3:45 am #351090Hi!
Are you re-setting WP-Super-Cache on each try? your javascript code seems unchanged on my end.
Cheers!
JosueNovember 14, 2014 at 4:57 am #351117Yes – works now- Thanks!
I thought I deleted cache – but you were right the js wasn’t updated. Sometimes the cache is stubborn.November 14, 2014 at 5:43 am #351134You are welcome, glad to help :)
Regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.