Created
August 5, 2016 08:17
-
-
Save constantm/ad6e71adadb81b3f31ea87af4374ccd1 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
def candidate_analytics_track(user) | |
# Alias user on Mixpanel so we can track unique visits -> signup | |
if cookies['visit_id'] | |
Analytics.alias(previous_id: cookies[:visit_id], user_id: user._id.to_s) | |
Analytics.flush # We need this to prevent race conditions and split profiles on Mixpanel | |
cookies.delete :visit_id | |
end | |
Analytics.identify( | |
user_id: "#{user._id}", | |
traits: { | |
email: "#{user.email }", | |
name: "#{user.profile.name}", | |
created_at: "#{user.created_at}", | |
type: "user" | |
# more properties here | |
}) | |
Analytics.track( | |
user_id: "#{user._id}", | |
event: "signup-candidate") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment