Last active
December 14, 2015 12:38
-
-
Save calvinfo/5087538 to your computer and use it in GitHub Desktop.
Once per session tracking
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 () { | |
var traits = analytics.user.traits() | |
, session = traits.session | |
, now = +(new Date); // shim for Date.now in older browsers | |
if (!session || (now - session) > 60*60*1000) { | |
// Track things which happen once a session | |
analytics.track('Once a session'); | |
// Update the user | |
analytics.user.update({ session : now }); | |
} | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment