Last active
September 22, 2017 15:44
-
-
Save gjrevans/1205c1993d391813ef19dede5a9cbfd9 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
/* Identify the current logged-in user with Segment.io */ | |
segment_user = { | |
first_name: "<%= @current_user.first_name %>", | |
last_name: "<%= @current_user.last_name %>", | |
email: "<%= @current_user.email %>", | |
date_of_birth: "<%= @current_user.birthdate %>" | |
}; | |
/* Add a company if the user is part of a group */ | |
<%= if assigns[:group] do %> | |
segment_user.company = { | |
name: "<%= @group.name %>", | |
id: "<%= @group.slug %>", | |
createdAt: "<%= @group.inserted_at %>", | |
} | |
<% end %> | |
analytics.identify("<%= @current_user.id %>", segment_user, { | |
Intercom: { | |
user_hash: "<%= :crypto.hmac(:sha256, Logit.Helper.Variables.intercom_identity_verification_secret, Integer.to_string(@current_user.id)) |> Base.encode16 |> String.downcase %>" | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment