Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a href="#" class="ga-track" data-category='Schedule Appointment' data-action='click' data-label='Website'>Link</a>
- <script type="text/javascript">
- var trackEl = document.querySelectorAll('.ga-track');
- Array.prototype.forEach.call(trackEl, function(el) {
- el.onclick = function() {
- var elCategory = this.getAttribute('data-category');
- var elAction = this.getAttribute('data-action');
- var elLabel = this.getAttribute('data-label');
- ga('send', 'event', elCategory, elAction, elLabel);
- };
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement