Sha256: a072e7d1d4927fe09b611964b1af1ab5221c7ce46ff9a396b337b0879d9cd079
Contents?: true
Size: 690 Bytes
Versions: 5
Compression:
Stored size: 690 Bytes
Contents
require "request_store" module Ahoy module Controller def self.included(base) base.helper_method :current_visit base.helper_method :ahoy base.before_filter :set_ahoy_cookies base.before_filter :track_ahoy_visit base.before_filter do RequestStore.store[:ahoy] ||= ahoy end end def ahoy @ahoy ||= Ahoy::Tracker.new(controller: self) end def current_visit ahoy.visit end def set_ahoy_cookies ahoy.set_visitor_cookie ahoy.set_visit_cookie end def track_ahoy_visit if ahoy.new_visit? ahoy.track_visit(defer: !Ahoy.track_visits_immediately) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems