Last active
August 29, 2015 14:17
-
-
Save bbeaird/1297b4eb382d500e7d94 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
def anonymousId provider | |
case provider | |
when "Segment" | |
anonId = request.cookies["ajs_anonymous_id"].gsub("\"", "") | |
when "Mixpanel" | |
mp = request.cookies.detect{ |key| key.to_s =~ Regexp.new("mp_.+_mixpanel") }[1].split(': ') | |
anonId = mp[1].gsub(",\"$initial_referrer\"", "").gsub("\"", "") | |
when "Google" | |
anonId = request.cookies["_ga"][6..-1] | |
else | |
puts "Unrecognized provider" | |
end | |
anonId | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment