satellite 0.1.1 → 0.2.0
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.
- data/VERSION +1 -1
- data/lib/satellite/adapters/google_analytics.rb +11 -7
- data/lib/support/object.rb +0 -4
- data/satellite.gemspec +1 -1
- data/test/helper.rb +1 -1
- data/test/test_satellite.rb +13 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -2,20 +2,24 @@ module Satellite
|
|
2
2
|
module Adapters
|
3
3
|
class GoogleAnalytics
|
4
4
|
|
5
|
+
attr_accessor :debug, :user_agent, :accept_language
|
6
|
+
|
5
7
|
def initialize(params, use_ssl=false)
|
6
8
|
self.utm_params = extend_with_default_params(params)
|
7
9
|
self.utm_location = (use_ssl ? 'https://ssl' : 'http://www') + UTM_GIF_LOCATION
|
8
10
|
end
|
9
11
|
|
10
12
|
def track
|
11
|
-
#puts utm_params.inspect
|
12
|
-
|
13
13
|
utm_url = tracking_url
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
#if (debug == true)
|
16
|
+
puts "--------sending request to GA-----------------------"
|
17
|
+
puts utm_params.inspect
|
18
|
+
puts utm_url
|
19
|
+
#end
|
17
20
|
|
18
|
-
|
21
|
+
# actually send request
|
22
|
+
open(utm_url, { "User-Agent" => 'Satellite/0.1.1', "Accept-Language" => utm_params[:utmul] || 'de' })
|
19
23
|
|
20
24
|
# reset events / custom variables here
|
21
25
|
utm_params.delete(:utme)
|
@@ -125,13 +129,13 @@ module Satellite
|
|
125
129
|
|
126
130
|
@@regex_event = /5\((\w+)\*(\w+)(\*(\w+))?\)(\((\d+)\))?/
|
127
131
|
@@regex_custom_variables = /8\(([^\)]*)\)9\(([^\)]*)\)(11\(([^\)]*)\))?/
|
128
|
-
@@regex_custom_variable_value = /((\d)!)?(
|
132
|
+
@@regex_custom_variable_value = /((\d)!)?([^\(\*]+)/
|
129
133
|
|
130
134
|
def parse(args)
|
131
135
|
return self.new if args.nil?
|
132
136
|
case args
|
133
137
|
when String
|
134
|
-
return self.from_string(args)
|
138
|
+
return self.from_string(args.dup)
|
135
139
|
when self
|
136
140
|
return args
|
137
141
|
else
|
data/lib/support/object.rb
CHANGED
@@ -2,10 +2,6 @@ unless Object.const_defined?("ActiveSupport")
|
|
2
2
|
class Object
|
3
3
|
def to_query(key)
|
4
4
|
require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
|
5
|
-
|
6
|
-
puts self.inspect
|
7
|
-
puts to_param
|
8
|
-
|
9
5
|
"#{CGI.escape(key.to_s).gsub(/%(5B|5D)/n) { [$1].pack('H*') }}=#{CGI.escape(to_param.to_s)}"
|
10
6
|
end
|
11
7
|
|
data/satellite.gemspec
CHANGED
data/test/helper.rb
CHANGED
@@ -15,7 +15,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
15
15
|
require 'satellite'
|
16
16
|
|
17
17
|
# used for storing private data like google account_id
|
18
|
-
require 'local_conf' if File.exists?('local_conf.rb')
|
18
|
+
require 'local_conf' if File.exists?(File.dirname(__FILE__) + '/local_conf.rb')
|
19
19
|
|
20
20
|
class Test::Unit::TestCase
|
21
21
|
end
|
data/test/test_satellite.rb
CHANGED
@@ -49,10 +49,21 @@ class TestSatellite < Test::Unit::TestCase
|
|
49
49
|
#:utmhid => '1655425535', auto
|
50
50
|
:utmr => 'test.local/properly track a page view',
|
51
51
|
:utmp => '/test/properly-track-page-view',
|
52
|
-
|
52
|
+
#:utmac => nil, #set via 'Satellite::Adapters::GoogleAnalytics.account_id' in local_conf.rb
|
53
53
|
})
|
54
|
-
|
54
|
+
|
55
55
|
assert_equal tracker.track_page_view, true
|
56
56
|
end
|
57
|
+
|
58
|
+
context 'utme' do
|
59
|
+
|
60
|
+
should "properly parse given utme string" do
|
61
|
+
utme_string = '5(controller*action*coupon_redeem)(10)8(test*test2)9(Please_track_this*Tracking with whitepsace)11(1)'
|
62
|
+
|
63
|
+
utme = Satellite::Adapters::GoogleAnalytics::Utme.parse(utme_string)
|
64
|
+
|
65
|
+
assert_equal utme.to_s, utme_string
|
66
|
+
end
|
67
|
+
end
|
57
68
|
end
|
58
69
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: satellite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Maik Vlcek
|