mixpanel 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -0
- data/lib/mixpanel/tracker.rb +5 -3
- data/mixpanel.gemspec +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -57,6 +57,10 @@ To execute any javascript API call
|
|
57
57
|
@mixpanel.append_api("register", {:some => "property"})
|
58
58
|
@mixpanel.append_api("identify", "Unique Identifier")
|
59
59
|
|
60
|
+
If you are proxying Mixpanel API requests then you can set a custom url and additionally stop the token from being sent by marking it as false if you're going to let the proxy add it...
|
61
|
+
|
62
|
+
@mixpanel = Mixpanel::Tracker.new(flase, request.env, true, 'http://localhost:8000/mixpanelproxy?data=')
|
63
|
+
|
60
64
|
== Resque and Rails example
|
61
65
|
|
62
66
|
If you don't want to use the built in Mixpanel Gem async feature bellow there is an example about how to make async calls using Resque.
|
@@ -113,3 +117,4 @@ All collaborations are welcome to this project, please fork and make a pull requ
|
|
113
117
|
* {jakemack}[https://github.com/jakemack]
|
114
118
|
* {James Ferguson}[https://github.com/JamesFerguson]
|
115
119
|
* {Brad Wilson}[https://github.com/bradx3]
|
120
|
+
* {Mark Cheverton}[https://github.com/ennui2342]
|
data/lib/mixpanel/tracker.rb
CHANGED
@@ -6,10 +6,11 @@ require 'mixpanel/tracker/middleware'
|
|
6
6
|
|
7
7
|
module Mixpanel
|
8
8
|
class Tracker
|
9
|
-
def initialize(token, env, async = false)
|
9
|
+
def initialize(token, env, async = false, url = 'http://api.mixpanel.com/track/?data=')
|
10
10
|
@token = token
|
11
11
|
@env = env
|
12
12
|
@async = async
|
13
|
+
@url = url
|
13
14
|
clear_queue
|
14
15
|
end
|
15
16
|
|
@@ -22,7 +23,8 @@ module Mixpanel
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def track_event(event, properties = {})
|
25
|
-
options = { :
|
26
|
+
options = { :time => Time.now.utc.to_i, :ip => ip }
|
27
|
+
options.merge!( :token => @token ) if @token
|
26
28
|
options.merge!(properties)
|
27
29
|
params = build_event(event, options)
|
28
30
|
parse_response request(params)
|
@@ -83,7 +85,7 @@ module Mixpanel
|
|
83
85
|
|
84
86
|
def request(params)
|
85
87
|
data = Base64.encode64(JSON.generate(params)).gsub(/\n/,'')
|
86
|
-
url =
|
88
|
+
url = @url + data
|
87
89
|
|
88
90
|
if(@async)
|
89
91
|
w = Tracker.worker
|
data/mixpanel.gemspec
CHANGED
@@ -2,7 +2,7 @@ files = ['README.rdoc', 'LICENSE', 'Rakefile', 'mixpanel.gemspec', '{spec,lib}/*
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |s|
|
4
4
|
s.name = "mixpanel"
|
5
|
-
s.version = "1.1.
|
5
|
+
s.version = "1.1.3"
|
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"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
8
|
+
- 3
|
9
|
+
version: 1.1.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alvaro Gil
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-01-
|
17
|
+
date: 2012-01-11 00:00:00 -02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|