analytics_goo 0.2.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/analytics_goo.gemspec +2 -2
- data/lib/analytics_goo/google_analytics_adapter.rb +56 -23
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/analytics_goo.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{analytics_goo}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rob Christie"]
|
12
|
-
s.date = %q{2012-04-
|
12
|
+
s.date = %q{2012-04-26}
|
13
13
|
s.email = %q{robchristie@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.markdown",
|
@@ -38,12 +38,36 @@
|
|
38
38
|
# utmttx
|
39
39
|
# Tax. Values as for unit and price. utmttx=29.16
|
40
40
|
|
41
|
+
# utmcs
|
42
|
+
# Language encoding for the browser. Some browsers dont set this, in which case it is set to "-"
|
43
|
+
# utmcs=ISO-8859-1
|
44
|
+
# utmje
|
45
|
+
# Indicates if browser is Java-enabled. 1 is true. utmje=1
|
46
|
+
# utmsc
|
47
|
+
# Screen color depth utmsc=24-bit
|
48
|
+
# utmsr
|
49
|
+
# Screen resolution utmsr=2400x1920&
|
50
|
+
# utmul
|
51
|
+
# Browser language. utmul=pt-br
|
52
|
+
# utmwv
|
53
|
+
# Tracking code version utmwv=1
|
54
|
+
# utmcn
|
55
|
+
# Starts a new campaign session. Either utmcn or utmcr is present on any given request. Changes the campaign tracking data; but does not start a new session
|
56
|
+
# utmcn=1
|
57
|
+
# utmcr
|
58
|
+
# Indicates a repeat campaign visit. This is set when any subsequent clicks occur on the same link. Either utmcn or utmcr is present on any given request.
|
59
|
+
# utmcr=1
|
60
|
+
# utmcc
|
61
|
+
# Cookie values. This request parameter sends all the cookies requested from the page.
|
62
|
+
|
41
63
|
module AnalyticsGoo
|
42
64
|
class GoogleAnalyticsAdapter
|
43
65
|
attr_accessor :domain, :analytics_id, :env, :noop, :page_title, :remote_address,
|
44
66
|
:referrer, :user_agent, :http_accept_language, :campaign, :source,
|
45
|
-
:medium, :term, :content
|
46
|
-
|
67
|
+
:medium, :term, :content, :language_encoding, :java_enabled,
|
68
|
+
:screen_color_depth, :screen_resolution, :browser_language,
|
69
|
+
:tracking_code_version, :new_campaign_session, :repeat_campaign_visit,
|
70
|
+
:cookie_values
|
47
71
|
|
48
72
|
def initialize(ac)
|
49
73
|
# sets the environment that this should be run in
|
@@ -51,23 +75,32 @@ module AnalyticsGoo
|
|
51
75
|
@domain = ac[:domain]
|
52
76
|
@env = ac[:environment]
|
53
77
|
@noop = ac[:noop] || false
|
54
|
-
@page_title = ac[:page_title] ||
|
55
|
-
@referrer = ac[:referrer] ||
|
78
|
+
@page_title = ac[:page_title] || ''
|
79
|
+
@referrer = ac[:referrer] || '-'
|
56
80
|
@remote_address = ac[:remote_address]
|
57
|
-
@user_agent = ac[:user_agent] ||
|
58
|
-
@http_accept_language = ac[:http_accept_language] ||
|
59
|
-
@campaign = ac[:campaign] ||
|
60
|
-
@source = ac[:source] ||
|
61
|
-
@medium = ac[:medium] ||
|
62
|
-
@term = ac[:term] ||
|
63
|
-
@content = ac[:content] ||
|
81
|
+
@user_agent = ac[:user_agent] || ''
|
82
|
+
@http_accept_language = ac[:http_accept_language] || ''
|
83
|
+
@campaign = ac[:campaign] || ''
|
84
|
+
@source = ac[:source] || ''
|
85
|
+
@medium = ac[:medium] || ''
|
86
|
+
@term = ac[:term] || ''
|
87
|
+
@content = ac[:content] || ''
|
88
|
+
@language_encoding = ac[:language_encoding] || 'UTF-8'
|
89
|
+
@java_enabled = ac[:java_enabled] || '1'
|
90
|
+
@screen_color_depth = ac[:screen_color_depth] || '0-bit'
|
91
|
+
@screen_resolution = ac[:screen_resolution] || '0x0'
|
92
|
+
@browser_language = ac[:browser_language] || 'en-us'
|
93
|
+
@tracking_code_version = ac[:tracking_code_version] || '4.4sj'
|
94
|
+
@new_campaign_session = ac[:new_campaign_session] || '1'
|
95
|
+
@repeat_campaign_visit = ac[:repeat_campaign_visit] || '1'
|
96
|
+
@cookie_values = ac[:cookie_values] || '__utma%3D999.999.999.999.999.1%3B'
|
64
97
|
end
|
65
98
|
|
66
|
-
GA_DOMAIN =
|
67
|
-
GA_IMAGE =
|
99
|
+
GA_DOMAIN = 'www.google-analytics.com'
|
100
|
+
GA_IMAGE = '__utm.gif'
|
68
101
|
|
69
102
|
def urchin_url(ssl = false)
|
70
|
-
protocol = (ssl == true) ?
|
103
|
+
protocol = (ssl == true) ? 'https' : 'http'
|
71
104
|
"#{protocol}://#{GA_DOMAIN}/#{GA_IMAGE}"
|
72
105
|
end
|
73
106
|
|
@@ -86,13 +119,13 @@ module AnalyticsGoo
|
|
86
119
|
# Language encoding for the browser. Some browsers don't set this, in which case it is set to "-"
|
87
120
|
# utmcs=ISO-8859-1
|
88
121
|
def utmcs
|
89
|
-
|
122
|
+
self.language_encoding
|
90
123
|
end
|
91
124
|
|
92
125
|
# utmje
|
93
126
|
# Indicates if browser is Java-enabled. 1 is true. utmje=1
|
94
127
|
def utmje
|
95
|
-
|
128
|
+
self.java_enabled
|
96
129
|
end
|
97
130
|
|
98
131
|
# utmn
|
@@ -104,25 +137,25 @@ module AnalyticsGoo
|
|
104
137
|
# utmsc
|
105
138
|
# Screen color depth utmsc=24-bit
|
106
139
|
def utmsc
|
107
|
-
|
140
|
+
self.screen_color_depth
|
108
141
|
end
|
109
142
|
|
110
143
|
# utmsr
|
111
144
|
# Screen resolution utmsr=2400x1920&
|
112
145
|
def utmsr
|
113
|
-
|
146
|
+
self.screen_resolution
|
114
147
|
end
|
115
148
|
|
116
149
|
# utmul
|
117
150
|
# Browser language. utmul=pt-br
|
118
151
|
def utmul
|
119
|
-
|
152
|
+
self.browser_language
|
120
153
|
end
|
121
154
|
|
122
155
|
# utmwv
|
123
156
|
# Tracking code version utmwv=1
|
124
157
|
def utmwv
|
125
|
-
|
158
|
+
self.tracking_code_version
|
126
159
|
end
|
127
160
|
|
128
161
|
# utmp
|
@@ -152,21 +185,21 @@ module AnalyticsGoo
|
|
152
185
|
# utmcn Starts a new campaign session. Either utmcn or utmcr is present on any given request. Changes the campaign tracking data; but does not start a new session
|
153
186
|
# utmcn=1
|
154
187
|
def utmcn
|
155
|
-
|
188
|
+
self.new_campaign_session
|
156
189
|
end
|
157
190
|
|
158
191
|
# utmcr
|
159
192
|
# Indicates a repeat campaign visit. This is set when any subsequent clicks occur on the same link. Either utmcn or utmcr is present on any given request.
|
160
193
|
# utmcr=1
|
161
194
|
def utmcr
|
162
|
-
|
195
|
+
self.repeat_campaign_visit
|
163
196
|
end
|
164
197
|
|
165
198
|
# utmcc
|
166
199
|
# Cookie values. This request parameter sends all the cookies requested from the page.
|
167
200
|
# utmcc=__utma%3D117243.1695285.22%3B%2B __utmz%3D117945243.1202416366.21.10. utmcsr%3Db%7C utmccn%3D(referral)%7C utmcmd%3Dreferral%7C utmcct%3D%252Fissue%3B%2B
|
168
201
|
def utmcc
|
169
|
-
|
202
|
+
self.cookie_values
|
170
203
|
end
|
171
204
|
|
172
205
|
def utmdt
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: analytics_goo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rob Christie
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-26 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|