google-analytics-rails 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.travis.yml +23 -0
 - data/CHANGELOG.markdown +7 -0
 - data/Gemfile +17 -0
 - data/README.markdown +3 -1
 - data/Rakefile +2 -0
 - data/google-analytics-rails.gemspec +2 -7
 - data/lib/google-analytics-rails.rb +14 -10
 - data/lib/google-analytics/rails/view_helpers.rb +7 -0
 - data/lib/google-analytics/version.rb +1 -1
 - data/test/async_tracking_queue_test.rb +33 -3
 - data/test/rails/views_helper_test.rb +19 -0
 - metadata +13 -82
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8c2e23eb0911637dd83f62ec98c1c03256f43a5a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 497a0afcd20fe6656b448f861fe73550996ac6bb
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 66edf6112899995ec356fd7ae78549a95ab85f40874a2e189eaf9ba90401b3c31f2b2f56b0516395d1f548219cc01eb5de9933b927e41f934c282b20e8d14456
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 74fe46cefabd308f2bd9f7252121537948b170a1f700dd7cceba51427616d509568d23b345fa597808976de816049db8e9bdd1fc67206514f1b5a063641ae6c7
         
     | 
    
        data/.travis.yml
    ADDED
    
    | 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            language: ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            bundler_args: --without development
         
     | 
| 
      
 3 
     | 
    
         
            +
            rvm:
         
     | 
| 
      
 4 
     | 
    
         
            +
              - 1.8.7
         
     | 
| 
      
 5 
     | 
    
         
            +
              - 1.9.2
         
     | 
| 
      
 6 
     | 
    
         
            +
              - 1.9.3
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 2.0.0
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 2.1
         
     | 
| 
      
 9 
     | 
    
         
            +
              - rbx-2
         
     | 
| 
      
 10 
     | 
    
         
            +
              - ruby-head
         
     | 
| 
      
 11 
     | 
    
         
            +
            matrix:
         
     | 
| 
      
 12 
     | 
    
         
            +
              include:
         
     | 
| 
      
 13 
     | 
    
         
            +
                - rvm: jruby-18mode
         
     | 
| 
      
 14 
     | 
    
         
            +
                  env: JRUBY_OPTS="$JRUBY_OPTS --debug"
         
     | 
| 
      
 15 
     | 
    
         
            +
                - rvm: jruby-19mode
         
     | 
| 
      
 16 
     | 
    
         
            +
                  env: JRUBY_OPTS="$JRUBY_OPTS --debug"
         
     | 
| 
      
 17 
     | 
    
         
            +
                - rvm: jruby-head
         
     | 
| 
      
 18 
     | 
    
         
            +
                  env: JRUBY_OPTS="$JRUBY_OPTS --debug"
         
     | 
| 
      
 19 
     | 
    
         
            +
              allow_failures:
         
     | 
| 
      
 20 
     | 
    
         
            +
                - rvm: jruby-head
         
     | 
| 
      
 21 
     | 
    
         
            +
                - rvm: rbx-2
         
     | 
| 
      
 22 
     | 
    
         
            +
                - rvm: ruby-head
         
     | 
| 
      
 23 
     | 
    
         
            +
              fast_finish: true
         
     | 
    
        data/CHANGELOG.markdown
    CHANGED
    
    | 
         @@ -1,3 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            0.0.6
         
     | 
| 
      
 2 
     | 
    
         
            +
            =====
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            * Add support for sending `custom_vars` in proper sequence while doing `analytics_init` [PR#20](https://github.com/bgarret/google-analytics-rails/pull/20) (thanks to @yonda).
         
     | 
| 
      
 5 
     | 
    
         
            +
            * Make switching between DoubleClick and default `ga.js` simpler. [PR#23](https://github.com/bgarret/google-analytics-rails/pull/23) (thanks to @rafamanzo).
         
     | 
| 
      
 6 
     | 
    
         
            +
            * Start testing the library regularly against Ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1, JRuby-1.8mode and JRuby-1.9mode.
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       1 
8 
     | 
    
         
             
            0.0.5
         
     | 
| 
       2 
9 
     | 
    
         
             
            =====
         
     | 
| 
       3 
10 
     | 
    
         | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -1,4 +1,21 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            source "http://rubygems.org"
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            gem 'rake'
         
     | 
| 
      
 4 
     | 
    
         
            +
            gem 'yard'
         
     | 
| 
      
 5 
     | 
    
         
            +
            gem 'activesupport', "~> 3.0"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            group :development do
         
     | 
| 
      
 8 
     | 
    
         
            +
              gem 'pry'
         
     | 
| 
      
 9 
     | 
    
         
            +
              platforms :ruby_19, :ruby_20, :ruby_21 do
         
     | 
| 
      
 10 
     | 
    
         
            +
                gem 'pry-stack_explorer'
         
     | 
| 
      
 11 
     | 
    
         
            +
                gem 'redcarpet'
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            group :test do
         
     | 
| 
      
 16 
     | 
    
         
            +
              gem 'json'
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       3 
19 
     | 
    
         
             
            # Specify your gem's dependencies in google-analytics-rails.gemspec
         
     | 
| 
       4 
20 
     | 
    
         
             
            gemspec
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
    
        data/README.markdown
    CHANGED
    
    | 
         @@ -1,5 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Fast Google Analytics setup for Rails 3. This gem is mostly intended for small to medium websites with a simple analytics strategy.
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            [](https://travis-ci.org/bgarret/google-analytics-rails)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       3 
5 
     | 
    
         
             
            Installation
         
     | 
| 
       4 
6 
     | 
    
         
             
            ============
         
     | 
| 
       5 
7 
     | 
    
         | 
| 
         @@ -38,7 +40,7 @@ With DoubleClick instead of vanilla Google Analytics script 
     | 
|
| 
       38 
40 
     | 
    
         | 
| 
       39 
41 
     | 
    
         
             
                # replace this with your tracker code
         
     | 
| 
       40 
42 
     | 
    
         
             
                GA.tracker = "UA-xxxxxx-x"
         
     | 
| 
       41 
     | 
    
         
            -
                GA.script_source =  
     | 
| 
      
 43 
     | 
    
         
            +
                GA.script_source = :doubleclick
         
     | 
| 
       42 
44 
     | 
    
         | 
| 
       43 
45 
     | 
    
         
             
            `app/views/layout/application.html.erb`, in the `<head>` tag :
         
     | 
| 
       44 
46 
     | 
    
         | 
    
        data/Rakefile
    CHANGED
    
    
| 
         @@ -6,19 +6,14 @@ Gem::Specification.new do |s| 
     | 
|
| 
       6 
6 
     | 
    
         
             
              s.name        = "google-analytics-rails"
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.version     = GoogleAnalytics::VERSION
         
     | 
| 
       8 
8 
     | 
    
         
             
              s.platform    = Gem::Platform::RUBY
         
     | 
| 
       9 
     | 
    
         
            -
              s.authors     = ["Benoit Garret"]
         
     | 
| 
       10 
     | 
    
         
            -
              s.email       = ["benoit.garret@gadz.org"]
         
     | 
| 
      
 9 
     | 
    
         
            +
              s.authors     = ["Benoit Garret", "Ufuk Kayserilioglu"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              s.email       = ["benoit.garret@gadz.org", "ufuk@paralaus.com"]
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.homepage    = "https://github.com/bgarret/google-analytics-rails"
         
     | 
| 
       12 
12 
     | 
    
         
             
              s.summary     = %q{Rails 3 helpers to manage google analytics tracking}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = %q{Rails 3 helpers to manage google analytics tracking}
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              s.rubyforge_project = "google-analytics-rails"
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              s.add_development_dependency "rake"
         
     | 
| 
       18 
     | 
    
         
            -
              s.add_development_dependency "yard"
         
     | 
| 
       19 
     | 
    
         
            -
              s.add_development_dependency "redcarpet"
         
     | 
| 
       20 
     | 
    
         
            -
              s.add_development_dependency "activesupport", "~>3.0"
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
17 
     | 
    
         
             
              s.files         = `git ls-files`.split("\n")
         
     | 
| 
       23 
18 
     | 
    
         
             
              s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         
     | 
| 
       24 
19 
     | 
    
         
             
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         
     | 
| 
         @@ -6,8 +6,15 @@ require 'google-analytics/events' 
     | 
|
| 
       6 
6 
     | 
    
         
             
            module GoogleAnalytics
         
     | 
| 
       7 
7 
     | 
    
         
             
              # @private
         
     | 
| 
       8 
8 
     | 
    
         
             
              PLACEHOLDER_TRACKER = "UA-xxxxxx-x"
         
     | 
| 
      
 9 
     | 
    
         
            +
              # GA sources.
         
     | 
| 
      
 10 
     | 
    
         
            +
              # Allowing easy switch between DEFAULT and DoubleClick scripts.
         
     | 
| 
      
 11 
     | 
    
         
            +
              # @see http://support.google.com/analytics/bin/answer.py?hl=en&answer=2444872 for more info
         
     | 
| 
      
 12 
     | 
    
         
            +
              #
         
     | 
| 
       9 
13 
     | 
    
         
             
              # @private
         
     | 
| 
       10 
     | 
    
         
            -
               
     | 
| 
      
 14 
     | 
    
         
            +
              SCRIPT_SOURCES = {
         
     | 
| 
      
 15 
     | 
    
         
            +
                :default     => "('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'",
         
     | 
| 
      
 16 
     | 
    
         
            +
                :doubleclick => "('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'",
         
     | 
| 
      
 17 
     | 
    
         
            +
              }
         
     | 
| 
       11 
18 
     | 
    
         | 
| 
       12 
19 
     | 
    
         
             
              # Get the current tracker id (*UA-xxxxxx-x*).
         
     | 
| 
       13 
20 
     | 
    
         
             
              # @return [String]
         
     | 
| 
         @@ -26,22 +33,19 @@ module GoogleAnalytics 
     | 
|
| 
       26 
33 
     | 
    
         
             
                tracker.nil? || tracker == "" || tracker == PLACEHOLDER_TRACKER ? false : true
         
     | 
| 
       27 
34 
     | 
    
         
             
              end
         
     | 
| 
       28 
35 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
              # Get the current ga src.
         
     | 
| 
       30 
     | 
    
         
            -
              # This allows for example to use the compatible doubleclick code :
         
     | 
| 
       31 
     | 
    
         
            -
              # ```
         
     | 
| 
       32 
     | 
    
         
            -
              #   ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'
         
     | 
| 
       33 
     | 
    
         
            -
              # ```
         
     | 
| 
       34 
     | 
    
         
            -
              # @see http://support.google.com/analytics/bin/answer.py?hl=en&answer=2444872 for more info
         
     | 
| 
       35 
     | 
    
         
            -
              #
         
     | 
| 
       36 
36 
     | 
    
         
             
              # @return [String]
         
     | 
| 
       37 
37 
     | 
    
         
             
              def self.script_source
         
     | 
| 
       38 
     | 
    
         
            -
                @@src ||=  
     | 
| 
      
 38 
     | 
    
         
            +
                @@src ||= SCRIPT_SOURCES[:default]
         
     | 
| 
       39 
39 
     | 
    
         
             
              end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
              # Set the current ga src.
         
     | 
| 
       42 
42 
     | 
    
         
             
              # @return [String]
         
     | 
| 
       43 
43 
     | 
    
         
             
              def self.script_source=(src)
         
     | 
| 
       44 
     | 
    
         
            -
                 
     | 
| 
      
 44 
     | 
    
         
            +
                if SCRIPT_SOURCES.has_key?(src)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  @@src = SCRIPT_SOURCES[src]
         
     | 
| 
      
 46 
     | 
    
         
            +
                else
         
     | 
| 
      
 47 
     | 
    
         
            +
                  @@src = src
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
       45 
49 
     | 
    
         
             
              end
         
     | 
| 
       46 
50 
     | 
    
         
             
            end
         
     | 
| 
       47 
51 
     | 
    
         | 
| 
         @@ -68,6 +68,7 @@ module GoogleAnalytics::Rails 
     | 
|
| 
       68 
68 
     | 
    
         
             
                # @option options [Boolean] :enhanced_link_attribution
         
     | 
| 
       69 
69 
     | 
    
         
             
                #   See separate information for multiple links on a page that all have the same destination,
         
     | 
| 
       70 
70 
     | 
    
         
             
                #   see {https://support.google.com/analytics/answer/2558867}.
         
     | 
| 
      
 71 
     | 
    
         
            +
                # @option options [Array, GoogleAnalytics::Events::SetCustomVar] :custom_vars ([])
         
     | 
| 
       71 
72 
     | 
    
         
             
                #
         
     | 
| 
       72 
73 
     | 
    
         
             
                # @example Set the local bit in development mode
         
     | 
| 
       73 
74 
     | 
    
         
             
                #   analytics_init :local => Rails.env.development?
         
     | 
| 
         @@ -85,6 +86,8 @@ module GoogleAnalytics::Rails 
     | 
|
| 
       85 
86 
     | 
    
         | 
| 
       86 
87 
     | 
    
         
             
                  local = options.delete(:local) || false
         
     | 
| 
       87 
88 
     | 
    
         
             
                  anonymize = options.delete(:anonymize) || false
         
     | 
| 
      
 89 
     | 
    
         
            +
                  custom_vars = options.delete(:custom_vars) || []
         
     | 
| 
      
 90 
     | 
    
         
            +
                  custom_vars = [custom_vars] unless custom_vars.is_a?(Array)
         
     | 
| 
       88 
91 
     | 
    
         
             
                  link_attribution = options.delete(:enhanced_link_attribution) || false
         
     | 
| 
       89 
92 
     | 
    
         
             
                  domain = options.delete(:domain) || (local ? "none" : "auto")
         
     | 
| 
       90 
93 
     | 
    
         
             
                  events = options.delete(:add_events) || []
         
     | 
| 
         @@ -96,6 +99,10 @@ module GoogleAnalytics::Rails 
     | 
|
| 
       96 
99 
     | 
    
         
             
                  events.unshift GA::Events::TrackPageview.new(options[:page])
         
     | 
| 
       97 
100 
     | 
    
         
             
                  # anonymize if needed before tracking the page view
         
     | 
| 
       98 
101 
     | 
    
         
             
                  events.unshift GA::Events::AnonymizeIp.new if anonymize
         
     | 
| 
      
 102 
     | 
    
         
            +
                  # custom_var if needed before tracking the page view
         
     | 
| 
      
 103 
     | 
    
         
            +
                  custom_vars.each do |custom_var|
         
     | 
| 
      
 104 
     | 
    
         
            +
                    events.unshift custom_var
         
     | 
| 
      
 105 
     | 
    
         
            +
                  end
         
     | 
| 
       99 
106 
     | 
    
         
             
                  events.unshift GA::Events::SetDomainName.new(domain)
         
     | 
| 
       100 
107 
     | 
    
         
             
                  if local
         
     | 
| 
       101 
108 
     | 
    
         
             
                    events.unshift GA::Events::SetAllowLinker.new(true)
         
     | 
| 
         @@ -22,7 +22,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
              def test_queue_renders_valid_javascript_snippit
         
     | 
| 
       24 
24 
     | 
    
         
             
                gaq = GAQ.new
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
       26 
26 
     | 
    
         
             
                # Add 2 events to the default tracker
         
     | 
| 
       27 
27 
     | 
    
         
             
                gaq << GA::Event.new('event1', 1)
         
     | 
| 
       28 
28 
     | 
    
         
             
                gaq << GA::Event.new('event2', 2)
         
     | 
| 
         @@ -49,8 +49,8 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga 
     | 
|
| 
       49 
49 
     | 
    
         
             
            </script>
         
     | 
| 
       50 
50 
     | 
    
         
             
              JAVASCRIPT
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
              def  
     | 
| 
       53 
     | 
    
         
            -
                GoogleAnalytics.script_source =  
     | 
| 
      
 52 
     | 
    
         
            +
              def test_queue_renders_valid_javascript_snippit_with_doubleclick_src
         
     | 
| 
      
 53 
     | 
    
         
            +
                GoogleAnalytics.script_source = :doubleclick
         
     | 
| 
       54 
54 
     | 
    
         
             
                gaq = GAQ.new
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                # Add 2 events to the default tracker
         
     | 
| 
         @@ -63,4 +63,34 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga 
     | 
|
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
                assert_equal(VALID_DOUBLECLICK_SNIPPET, gaq.to_s)
         
     | 
| 
       65 
65 
     | 
    
         
             
              end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
              VALID_CUSTOM_SNIPPET = <<-JAVASCRIPT
         
     | 
| 
      
 68 
     | 
    
         
            +
            <script type="text/javascript">
         
     | 
| 
      
 69 
     | 
    
         
            +
            var _gaq = _gaq || [];
         
     | 
| 
      
 70 
     | 
    
         
            +
            _gaq.push(['event1',1]);
         
     | 
| 
      
 71 
     | 
    
         
            +
            _gaq.push(['event2',2]);
         
     | 
| 
      
 72 
     | 
    
         
            +
            _gaq.push(['t2.event1',1]);
         
     | 
| 
      
 73 
     | 
    
         
            +
            _gaq.push(['t2.event2',2]);
         
     | 
| 
      
 74 
     | 
    
         
            +
            (function() {
         
     | 
| 
      
 75 
     | 
    
         
            +
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
         
     | 
| 
      
 76 
     | 
    
         
            +
            ga.src = 'http://127.0.0.1/custom.js';
         
     | 
| 
      
 77 
     | 
    
         
            +
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
         
     | 
| 
      
 78 
     | 
    
         
            +
            })();
         
     | 
| 
      
 79 
     | 
    
         
            +
            </script>
         
     | 
| 
      
 80 
     | 
    
         
            +
              JAVASCRIPT
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
              def test_queue_renders_valid_javascript_snippit_with_custom_src
         
     | 
| 
      
 83 
     | 
    
         
            +
                GoogleAnalytics.script_source = "'http://127.0.0.1/custom.js'"
         
     | 
| 
      
 84 
     | 
    
         
            +
                gaq = GAQ.new
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                # Add 2 events to the default tracker
         
     | 
| 
      
 87 
     | 
    
         
            +
                gaq << GA::Event.new('event1', 1)
         
     | 
| 
      
 88 
     | 
    
         
            +
                gaq << GA::Event.new('event2', 2)
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                # Add 2 events for an alternate tracker
         
     | 
| 
      
 91 
     | 
    
         
            +
                gaq.push(GA::Event.new('event1', 1), 't2')
         
     | 
| 
      
 92 
     | 
    
         
            +
                gaq.push(GA::Event.new('event2', 2), 't2')
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                assert_equal(VALID_CUSTOM_SNIPPET, gaq.to_s)
         
     | 
| 
      
 95 
     | 
    
         
            +
              end
         
     | 
| 
       66 
96 
     | 
    
         
             
            end
         
     | 
| 
         @@ -152,6 +152,25 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga 
     | 
|
| 
       152 
152 
     | 
    
         
             
                assert_equal(VALID_EVENT_INIT, analytics_init(:add_events => GA::Events::SetAllowLinker.new(true)))
         
     | 
| 
       153 
153 
     | 
    
         
             
              end
         
     | 
| 
       154 
154 
     | 
    
         | 
| 
      
 155 
     | 
    
         
            +
              VALID_EVENT_INIT_WITH_CUSTOM_VARS = <<-JAVASCRIPT
         
     | 
| 
      
 156 
     | 
    
         
            +
            <script type="text/javascript">
         
     | 
| 
      
 157 
     | 
    
         
            +
            var _gaq = _gaq || [];
         
     | 
| 
      
 158 
     | 
    
         
            +
            _gaq.push(['_setAccount','TEST']);
         
     | 
| 
      
 159 
     | 
    
         
            +
            _gaq.push(['_setDomainName','auto']);
         
     | 
| 
      
 160 
     | 
    
         
            +
            _gaq.push(['_setCustomVar',1,'test','hoge',1]);
         
     | 
| 
      
 161 
     | 
    
         
            +
            _gaq.push(['_trackPageview']);
         
     | 
| 
      
 162 
     | 
    
         
            +
            (function() {
         
     | 
| 
      
 163 
     | 
    
         
            +
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
         
     | 
| 
      
 164 
     | 
    
         
            +
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
         
     | 
| 
      
 165 
     | 
    
         
            +
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
         
     | 
| 
      
 166 
     | 
    
         
            +
            })();
         
     | 
| 
      
 167 
     | 
    
         
            +
            </script>
         
     | 
| 
      
 168 
     | 
    
         
            +
              JAVASCRIPT
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
              def test_analytics_init_with_custom_vars
         
     | 
| 
      
 171 
     | 
    
         
            +
                assert_equal(VALID_EVENT_INIT_WITH_CUSTOM_VARS, analytics_init(:custom_vars => GA::Events::SetCustomVar.new(1, 'test', 'hoge',1)))
         
     | 
| 
      
 172 
     | 
    
         
            +
              end
         
     | 
| 
      
 173 
     | 
    
         
            +
             
     | 
| 
       155 
174 
     | 
    
         
             
              VALID_TRACK_EVENT = "_gaq.push(['_trackEvent','Videos','Play','Gone With the Wind',null]);"
         
     | 
| 
       156 
175 
     | 
    
         | 
| 
       157 
176 
     | 
    
         
             
              def test_analytics_track_event
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,89 +1,27 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: google-analytics-rails
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.6
         
     | 
| 
       6 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
7 
     | 
    
         
             
            - Benoit Garret
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Ufuk Kayserilioglu
         
     | 
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2014- 
     | 
| 
       13 
     | 
    
         
            -
            dependencies:
         
     | 
| 
       14 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
     | 
    
         
            -
              name: rake
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       17 
     | 
    
         
            -
                none: false
         
     | 
| 
       18 
     | 
    
         
            -
                requirements:
         
     | 
| 
       19 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       20 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       21 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       22 
     | 
    
         
            -
              type: :development
         
     | 
| 
       23 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       25 
     | 
    
         
            -
                none: false
         
     | 
| 
       26 
     | 
    
         
            -
                requirements:
         
     | 
| 
       27 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       28 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       29 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       30 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       31 
     | 
    
         
            -
              name: yard
         
     | 
| 
       32 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       33 
     | 
    
         
            -
                none: false
         
     | 
| 
       34 
     | 
    
         
            -
                requirements:
         
     | 
| 
       35 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       36 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       37 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       38 
     | 
    
         
            -
              type: :development
         
     | 
| 
       39 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       40 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       41 
     | 
    
         
            -
                none: false
         
     | 
| 
       42 
     | 
    
         
            -
                requirements:
         
     | 
| 
       43 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       44 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       45 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       46 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       47 
     | 
    
         
            -
              name: redcarpet
         
     | 
| 
       48 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       49 
     | 
    
         
            -
                none: false
         
     | 
| 
       50 
     | 
    
         
            -
                requirements:
         
     | 
| 
       51 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       52 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       53 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       54 
     | 
    
         
            -
              type: :development
         
     | 
| 
       55 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       56 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       57 
     | 
    
         
            -
                none: false
         
     | 
| 
       58 
     | 
    
         
            -
                requirements:
         
     | 
| 
       59 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       60 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       62 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       63 
     | 
    
         
            -
              name: activesupport
         
     | 
| 
       64 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
     | 
    
         
            -
                none: false
         
     | 
| 
       66 
     | 
    
         
            -
                requirements:
         
     | 
| 
       67 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       68 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       69 
     | 
    
         
            -
                    version: '3.0'
         
     | 
| 
       70 
     | 
    
         
            -
              type: :development
         
     | 
| 
       71 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       72 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       73 
     | 
    
         
            -
                none: false
         
     | 
| 
       74 
     | 
    
         
            -
                requirements:
         
     | 
| 
       75 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       76 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       77 
     | 
    
         
            -
                    version: '3.0'
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2014-06-06 00:00:00.000000000 Z
         
     | 
| 
      
 13 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
       78 
14 
     | 
    
         
             
            description: Rails 3 helpers to manage google analytics tracking
         
     | 
| 
       79 
15 
     | 
    
         
             
            email:
         
     | 
| 
       80 
16 
     | 
    
         
             
            - benoit.garret@gadz.org
         
     | 
| 
      
 17 
     | 
    
         
            +
            - ufuk@paralaus.com
         
     | 
| 
       81 
18 
     | 
    
         
             
            executables: []
         
     | 
| 
       82 
19 
     | 
    
         
             
            extensions: []
         
     | 
| 
       83 
20 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       84 
21 
     | 
    
         
             
            files:
         
     | 
| 
       85 
     | 
    
         
            -
            - .gitignore
         
     | 
| 
       86 
     | 
    
         
            -
            - . 
     | 
| 
      
 22 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 23 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 24 
     | 
    
         
            +
            - ".yardopts"
         
     | 
| 
       87 
25 
     | 
    
         
             
            - CHANGELOG.markdown
         
     | 
| 
       88 
26 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       89 
27 
     | 
    
         
             
            - README.markdown
         
     | 
| 
         @@ -109,33 +47,26 @@ files: 
     | 
|
| 
       109 
47 
     | 
    
         
             
            - test/test_helper.rb
         
     | 
| 
       110 
48 
     | 
    
         
             
            homepage: https://github.com/bgarret/google-analytics-rails
         
     | 
| 
       111 
49 
     | 
    
         
             
            licenses: []
         
     | 
| 
      
 50 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       112 
51 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       113 
52 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       114 
53 
     | 
    
         
             
            require_paths:
         
     | 
| 
       115 
54 
     | 
    
         
             
            - lib
         
     | 
| 
       116 
55 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       117 
     | 
    
         
            -
              none: false
         
     | 
| 
       118 
56 
     | 
    
         
             
              requirements:
         
     | 
| 
       119 
     | 
    
         
            -
              - -  
     | 
| 
      
 57 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       120 
58 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       121 
59 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       122 
     | 
    
         
            -
                  segments:
         
     | 
| 
       123 
     | 
    
         
            -
                  - 0
         
     | 
| 
       124 
     | 
    
         
            -
                  hash: 3614566111248064777
         
     | 
| 
       125 
60 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       126 
     | 
    
         
            -
              none: false
         
     | 
| 
       127 
61 
     | 
    
         
             
              requirements:
         
     | 
| 
       128 
     | 
    
         
            -
              - -  
     | 
| 
      
 62 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       129 
63 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       130 
64 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       131 
     | 
    
         
            -
                  segments:
         
     | 
| 
       132 
     | 
    
         
            -
                  - 0
         
     | 
| 
       133 
     | 
    
         
            -
                  hash: 3614566111248064777
         
     | 
| 
       134 
65 
     | 
    
         
             
            requirements: []
         
     | 
| 
       135 
66 
     | 
    
         
             
            rubyforge_project: google-analytics-rails
         
     | 
| 
       136 
     | 
    
         
            -
            rubygems_version:  
     | 
| 
      
 67 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
       137 
68 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       138 
     | 
    
         
            -
            specification_version:  
     | 
| 
      
 69 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
       139 
70 
     | 
    
         
             
            summary: Rails 3 helpers to manage google analytics tracking
         
     | 
| 
       140 
71 
     | 
    
         
             
            test_files:
         
     | 
| 
       141 
72 
     | 
    
         
             
            - test/async_tracking_queue_test.rb
         
     |