Last active
July 19, 2017 07:59
-
-
Save coinso/247cf0aba29a11b846b274b41f637067 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($){ | |
| //time to event | |
| //set new variables when page is loading | |
| var d = new Date(); | |
| var timestamp = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds(); | |
| var c = 'time';//event category | |
| var a = 'click';//event action | |
| var l = 'time to event: '; //event label | |
| //console.log('started at:' + timestamp); | |
| //add element to track | |
| $('ele').click(function () { | |
| //create timestamp on event | |
| var f = new Date(); | |
| //create the difference in seconds | |
| var dif = parseInt((f - d)/600); | |
| var la = l.concat( dif + ' seconds'); | |
| //console.log('clicked on: ' + timestamp); | |
| //console.log(la); | |
| //send event to google - choose your right google code | |
| //_gaq.push(['_trackEvent', c, a, la]); | |
| //ga('send', 'event', c, a, la); | |
| }); | |
| })(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment