Sha256: fd8e732d8d567873eda15e2192f98d4cdad144b7dc12064f79846ea255a7930f

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

require 'landable/traffic/tracker'
require 'landable/traffic/crawl_tracker'
require 'landable/traffic/ping_tracker'
require 'landable/traffic/scan_tracker'
require 'landable/traffic/scrape_tracker'
require 'landable/traffic/user_tracker'
require 'landable/traffic/noop_tracker'

module Landable
  module Traffic
    def track_with_landable!
      yield and return if (request.headers["DNT"] || untracked_path)
      begin
        @tracker = Tracker.for self
        @tracker.track
      rescue => e
        Rails.logger.error e
        if respond_to? :newrelic_notice_error
          newrelic_notice_error e
        end
      end

      yield

      begin
        @tracker.save
      rescue => e
        Rails.logger.error e
        if respond_to? :newrelic_notice_error
          newrelic_notice_error e
        end
      end
    end

    def untracked_path
      Landable.configuration.untracked_paths.include? request.fullpath
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
landable-1.10.0.rc2 lib/landable/traffic.rb