Permalink
Browse files

save user_agent when tracking activity

  • Loading branch information...
1 parent 05574ea commit b589a9061a975a16f9e2f5100fdfad21644f10ce @jacquescrocker committed Jun 21, 2011
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/aarrr/session.rb
View
7 lib/aarrr/session.rb
@@ -70,6 +70,7 @@ def track(event_name, options = {})
"revenue" => options["revenue"],
"referral_code" => options["referral_code"],
"client" => options["client"] || get_client_name,
+ "user_agent" => options["user_agent"] || get_user_agent,
"created_at" => options["created_at"] || Time.now.getutc
})
@@ -229,6 +230,12 @@ def get_client_name
client_name || AARRR::Config.default_client
end
+ def get_user_agent
+ if env.present?
+ env["HTTP_USER_AGENT"].to_s
+ end
+ end
+
# returns updates
def build_attributes(env_or_object)
if env_or_object.is_a?(Hash)

0 comments on commit b589a90

Please sign in to comment.