Created
June 24, 2013 21:36
-
-
Save cmorss/5853811 to your computer and use it in GitHub Desktop.
This file contains 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
# Our app is a backbone.js app, so no 'normal' page loads. | |
class App.Actions | |
# Our version of identify to deal with logged in vs anonymous users. | |
identify: (options = {}) => | |
callback = options.callback | |
delete options.callback | |
# Is the user logged in? | |
if App.user | |
attrs = _.extend attrs, | |
email : App.user.get("email") | |
# set a bunch of other user specific properties | |
analytics.identify App.user.get("id"), attrs, callback | |
else | |
analytics.identify attrs, callback | |
# Actions#register is called right after a user successfully logs in. | |
register: (options) => | |
analytics.alias App.user.get("id") | |
func = => | |
@trackGAConv() | |
@identify callback: => | |
analytics.track 'Registered' # This is the first event we see for this user in MixPanel | |
# Do this delay to make sure the alias has happened. Problem? | |
_.delay func, 500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For signed in it looks like this: