woopra_track 0.1.2 → 0.1.3
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 +4 -4
- data/README.md +7 -1
- data/lib/woopra_track/tracker.rb +10 -0
- data/lib/woopra_track/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5cd80a9b897128d3188fc214d56920b0f6f6e71a
|
|
4
|
+
data.tar.gz: eb6b0184dd4c0f383473317738fe82cee005d0ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e37c7cac2c3225ca71a0e1544477c1eef7bac2bdf961e4c7a09825d63284f4c076c8b4babc209ec8f9fe58b80978f6dc0e8c51ac37e6894586dc718567a20ed2
|
|
7
|
+
data.tar.gz: c4c94bd8732f547324f213e0cdf382ccecfbb26d3c4ae9542ec074fc985ebe550ffb21d51c60038626ef1897805ad27b87a9f6efb268db132e21d8f312b057db
|
data/README.md
CHANGED
|
@@ -154,12 +154,18 @@ woopra(request, config, cookies)
|
|
|
154
154
|
@woopra.set_cookie(cookies)
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
If you want to enable logging for back-end tracking requests, just call `enable_logging`:
|
|
158
158
|
|
|
159
159
|
``` ruby
|
|
160
160
|
@woopra.enable_logging
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
+
You can also disable tracking globally, by setting `disable_tracking` to `true` in the config hash.
|
|
164
|
+
|
|
165
|
+
``` ruby
|
|
166
|
+
config = { domain: 'website.com', idle_timeout: 15000, disable_tracking: true }
|
|
167
|
+
```
|
|
168
|
+
|
|
163
169
|
## Development
|
|
164
170
|
|
|
165
171
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/woopra_track/tracker.rb
CHANGED
|
@@ -21,6 +21,7 @@ module WoopraTrack
|
|
|
21
21
|
hide_campaign: false,
|
|
22
22
|
ip_address: nil,
|
|
23
23
|
cookie_value: nil,
|
|
24
|
+
disable_tracking: false
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
def initialize(request)
|
|
@@ -88,6 +89,8 @@ module WoopraTrack
|
|
|
88
89
|
end
|
|
89
90
|
|
|
90
91
|
def javascript_tag
|
|
92
|
+
return if disable_tracking?
|
|
93
|
+
|
|
91
94
|
code = ['(function(){var t,i,e,n=window,o=document,a=arguments,s="script",r=["config","track","trackForm","trackClick","identify","visit","push","call"],c=function(){var t,i=this;for(i._e=[],t=0;r.length>t;t++)(function(t){i[t]=function(){return i._e.push([t].concat(Array.prototype.slice.call(arguments,0))),i}})(r[t])};for(n._w=n._w||{},t=0;a.length>t;t++)n._w[a[t]]=n[a[t]]=n[a[t]]||new c;i=o.createElement(s),i.async=1,i.src="//static.woopra.com/js/w.js",e=o.getElementsByTagName(s)[0],e.parentNode.insertBefore(i,e)})("woopra");']
|
|
92
95
|
|
|
93
96
|
code << "woopra.config(#{@custom_config.to_json});" if @custom_config.length != 0
|
|
@@ -107,12 +110,15 @@ module WoopraTrack
|
|
|
107
110
|
end
|
|
108
111
|
|
|
109
112
|
def set_cookie(cookies)
|
|
113
|
+
return if disable_tracking?
|
|
110
114
|
cookies[@current_config[:cookie_name]] = @current_config[:cookie_value]
|
|
111
115
|
end
|
|
112
116
|
|
|
113
117
|
private
|
|
114
118
|
|
|
115
119
|
def http_request(event=nil)
|
|
120
|
+
return if disable_tracking?
|
|
121
|
+
|
|
116
122
|
request_url = 'https://www.woopra.com'
|
|
117
123
|
get_params = {
|
|
118
124
|
host: @current_config[:domain],
|
|
@@ -168,5 +174,9 @@ module WoopraTrack
|
|
|
168
174
|
@request.remote_ip
|
|
169
175
|
end
|
|
170
176
|
end
|
|
177
|
+
|
|
178
|
+
def disable_tracking?
|
|
179
|
+
@current_config[:disable_tracking].is_a? TrueClass
|
|
180
|
+
end
|
|
171
181
|
end
|
|
172
182
|
end
|
data/lib/woopra_track/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: woopra_track
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonian Guveli
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-09-
|
|
11
|
+
date: 2017-09-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
101
101
|
version: '0'
|
|
102
102
|
requirements: []
|
|
103
103
|
rubyforge_project:
|
|
104
|
-
rubygems_version: 2.6.
|
|
104
|
+
rubygems_version: 2.6.13
|
|
105
105
|
signing_key:
|
|
106
106
|
specification_version: 4
|
|
107
107
|
summary: Tracking library for woopra.com
|