Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

save user_agent when tracking activity

  • Loading branch information...
commit b589a9061a975a16f9e2f5100fdfad21644f10ce 1 parent 05574ea
@railsjedi authored
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)
Please sign in to comment.
Something went wrong with that request. Please try again.