Skip to content

Instantly share code, notes, and snippets.

@sta1r
Last active April 3, 2017 09:32
Show Gist options
  • Select an option

  • Save sta1r/7547132 to your computer and use it in GitHub Desktop.

Select an option

Save sta1r/7547132 to your computer and use it in GitHub Desktop.
Add click event tracking to RoyalSlider
$(document).ready(function() {
$('.rsArrowRight').click(function () {
_gaq.push(['_trackEvent', 'RoyalSlider', 'Slider Arrow Right Click', 'Component ID: ' + $(this).closest('.slider-container').attr('id')]);
});
$('.rsArrowLeft').click(function () {
_gaq.push(['_trackEvent', 'RoyalSlider', 'Slider Arrow Left Click', 'Component ID: ' + $(this).closest('.slider-container').attr('id')]);
});
// <t4 type="navigation" id="49"/> = 'Current Section Name'
// if we could do this inline, you can substitute the content name from T4
// e.g. <a class="prev prevPage" onclick="_gaq.push(['_trackEvent', 'Micro Gallery', 'Prev page click', '<t4 type="content" name="Name" output="normal" modifiers="" />']);"></a>
});
@SieBer15

SieBer15 commented Apr 3, 2017

Copy link
Copy Markdown

Hello,

I am trying to make the RoyalSlider click events work with WP Google Analytics Events.
How can I accomplish this?

My website is at https://www.kasteelsterkenburg.nl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment