Added Analytics function to track user hits by ip address, referrer and user agent

This commit is contained in:
John Poulin
2014-04-08 17:24:57 -04:00
committed by cktricky
parent 5056f77395
commit 3f63480022
7 changed files with 95 additions and 3 deletions
+5 -1
View File
@@ -1,6 +1,6 @@
class ApplicationController < ActionController::Base
before_filter :authenticated, :has_info
before_filter :authenticated, :has_info, :create_analytic
helper_method :current_user, :is_admin?, :sanitize_font
# Our security guy keep talking about sea-surfing, cool story bro.
@@ -45,6 +45,10 @@ class ApplicationController < ActionController::Base
redirect_to home_dashboard_index_path if redirect
end
def create_analytic
Analytics.create({ :ip_address => request.remote_ip, :referrer => request.referrer, :user_agent => request.user_agent})
end
def sanitize_font(css)
css
# css if css.match(/\A[0-9]+([\%]|pt)\z/)