Skip to content

Instantly share code, notes, and snippets.

@josephbriggsmrf
Last active November 13, 2016 16:51
Show Gist options
  • Save josephbriggsmrf/132b9f51cbc6866c13891db2c6080526 to your computer and use it in GitHub Desktop.
Save josephbriggsmrf/132b9f51cbc6866c13891db2c6080526 to your computer and use it in GitHub Desktop.
GA Reveal JS
<script>
var reveal = document.querySelector('.reveal');
if (reveal) {
var title = document.querySelector('head title').innerText;
/* Send hit on slide change */
Reveal.addEventListener('slidechanged', function () {
ga('send', 'event', 'Decks', title, 'Changed current Slide', Reveal.getIndices().h);
});
/* Send hit on overview watch */
/* Show Overview */
Reveal.addEventListener('overviewshown', function () {
ga('send', 'event', 'Decks', 'overviewshown', 'Slide overview shown');
});
/* Hide Overview */
Reveal.addEventListener('overviewhidden', function () {
ga('send', 'event', 'Decks', 'overviewhidden', 'Slide overview hidden');
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment