mixpanel 3.5.0 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -52,6 +52,14 @@ initializer for it:
52
52
 
53
53
  Where **options** is a hash that accepts the following keys:
54
54
 
55
+ * **insert_mixpanel_scripts** : boolean
56
+
57
+ *Default: true*
58
+
59
+ By default the Mixpanel JavaScript API library scripts are inserted into the
60
+ HTML. If you'd prefer to insert them yourself, set the
61
+ insert_mixpanel_scripts flag to false.
62
+
55
63
  * **insert_js_last** : boolean
56
64
 
57
65
  *Default: false*
@@ -435,3 +443,4 @@ end
435
443
  * [Jeffrey Chu](https://github.com/jochu)
436
444
  * [Jon Pospischil] (https://github.com/pospischil)
437
445
  * [Tom Brown] (https://github.com/nottombrown)
446
+ * [Murilo Pereira] (https://github.com/mpereira)
@@ -7,6 +7,7 @@ module Mixpanel
7
7
  @app = app
8
8
  @token = mixpanel_token
9
9
  @options = {
10
+ :insert_mixpanel_scripts=> true,
10
11
  :insert_js_last => false,
11
12
  :persist => false,
12
13
  :config => {}
@@ -36,7 +37,9 @@ module Mixpanel
36
37
  insert_at = part.index(@options[:insert_js_last] ? '</body' : '</head')
37
38
  unless insert_at.nil?
38
39
  part.insert(insert_at, render_event_tracking_scripts) unless queue.empty?
39
- part.insert(insert_at, render_mixpanel_scripts) #This will insert the mixpanel initialization code before the queue of tracking events.
40
+ if @options[:insert_mixpanel_scripts]
41
+ part.insert(insert_at, render_mixpanel_scripts) #This will insert the mixpanel initialization code before the queue of tracking events.
42
+ end
40
43
  end
41
44
  elsif is_turbolink_request? && is_html_response?
42
45
  part.insert(part.index('</body'), render_event_tracking_scripts) unless queue.empty?
data/mixpanel.gemspec CHANGED
@@ -2,7 +2,7 @@ files = ['README.md', 'LICENSE', 'Rakefile', 'mixpanel.gemspec', '{spec,lib}/**/
2
2
 
3
3
  spec = Gem::Specification.new do |s|
4
4
  s.name = "mixpanel"
5
- s.version = "3.5.0"
5
+ s.version = "3.5.1"
6
6
  s.rubyforge_project = "mixpanel"
7
7
  s.description = "Simple lib to track events in Mixpanel service. It can be used in any rack based framework."
8
8
  s.author = "Alvaro Gil"
@@ -194,6 +194,18 @@ describe Mixpanel::Middleware do
194
194
  Nokogiri::HTML(last_response.body).search('body script').should_not be_empty
195
195
  end
196
196
  end
197
+
198
+ describe "With no mixpanel scripts" do
199
+ before do
200
+ setup_rack_application(DummyApp, {:body => html_document, :headers => {"Content-Type" => "text/html"}}, {:insert_mixpanel_scripts => false})
201
+ get "/"
202
+ end
203
+
204
+ it "should not insert mixpanel scripts" do
205
+ Nokogiri::HTML(last_response.body).search('head script').should be_empty
206
+ Nokogiri::HTML(last_response.body).search('body script').should be_empty
207
+ end
208
+ end
197
209
  end
198
210
  end
199
211
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixpanel
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-18 00:00:00.000000000Z
12
+ date: 2013-01-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &2153110960 !ruby/object:Gem::Requirement
16
+ requirement: &2152815840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153110960
24
+ version_requirements: *2152815840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rack
27
- requirement: &2153110520 !ruby/object:Gem::Requirement
27
+ requirement: &2152815400 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153110520
35
+ version_requirements: *2152815400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: escape
38
- requirement: &2153110100 !ruby/object:Gem::Requirement
38
+ requirement: &2152814980 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153110100
46
+ version_requirements: *2152814980
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &2153109680 !ruby/object:Gem::Requirement
49
+ requirement: &2152814560 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2153109680
57
+ version_requirements: *2152814560
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rack-test
60
- requirement: &2153109260 !ruby/object:Gem::Requirement
60
+ requirement: &2152814140 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153109260
68
+ version_requirements: *2152814140
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: fakeweb
71
- requirement: &2153108840 !ruby/object:Gem::Requirement
71
+ requirement: &2152813720 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2153108840
79
+ version_requirements: *2152813720
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: nokogiri
82
- requirement: &2153108420 !ruby/object:Gem::Requirement
82
+ requirement: &2152813300 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2153108420
90
+ version_requirements: *2152813300
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rake
93
- requirement: &2153108000 !ruby/object:Gem::Requirement
93
+ requirement: &2152812880 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2153108000
101
+ version_requirements: *2152812880
102
102
  description: Simple lib to track events in Mixpanel service. It can be used in any
103
103
  rack based framework.
104
104
  email: zevarito@gmail.com