Sha256: 6c858dbfb7724d14d292021d0b037c35f20c1831a7b5560635c6482e8838ae5f

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

module Sniffles
  module Sniffers
    class GoogleAnalytics
      include Text
      
      attr_accessor :doc
      attr_reader :output
      
      def initialize(response_body)
        @output = {}        
        parse(response_body) && process_document
      end
      
      def process_document
        if @output[:found] = found?
          parse_google_analytics_ua
        end
      end
      
      private
      def found?
        match?(/\.google\-analytics\.com|urchinTracker/i)
      end
      
      def parse_google_analytics_ua
        @output[:ua] = capture(/[\"|\'](UA\-[\d]+\-[\d])[\"|\']/)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sniffles-0.1.2 lib/sniffles/sniffers/analytics/google_analytics.rb