lib/landable/traffic.rb in landable-1.10.0.rc2 vs lib/landable/traffic.rb in landable-1.11.0
- old
+ new
@@ -7,11 +7,12 @@
require 'landable/traffic/noop_tracker'
module Landable
module Traffic
def track_with_landable!
- yield and return if (request.headers["DNT"] || untracked_path)
+ yield and return if untracked?
+
begin
@tracker = Tracker.for self
@tracker.track
rescue => e
Rails.logger.error e
@@ -30,10 +31,18 @@
newrelic_notice_error e
end
end
end
- def untracked_path
+ def untracked?
+ untracked_user? || untracked_path?
+ end
+
+ def untracked_user?
+ Landable.configuration.dnt_enabled && request.headers["DNT"] == "1"
+ end
+
+ def untracked_path?
Landable.configuration.untracked_paths.include? request.fullpath
end
end
end