exvo-metrics 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -2
- data/lib/exvo/metrics.rb +5 -0
- data/lib/exvo/metrics/version.rb +1 -1
- data/spec/exvo/metrics_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25ed9a81776ffc1bbae0e97cb4114a55b5fbd983
|
4
|
+
data.tar.gz: 5fa2a576e7681b9acd58dcfb4fc6a91577cd6810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deefd11ea8f73426f63ed897d823d36a843c975f5da704b9b0511b7d93888dbf548a4afd8a62febcc640cadd77a95415a134e5ac57f2f68041ed75423b4374d9
|
7
|
+
data.tar.gz: d327e49a6862f0060ef9371791f826a8e9441763bc7e30181c174c3df8d105efe95b50f4f65f86af74389153ab89c712e67878255fcab7d2a4d25f85199012a9
|
data/README.md
CHANGED
@@ -57,11 +57,18 @@ You can also pass some custom params, which will be visible in the Mixpanel dash
|
|
57
57
|
```
|
58
58
|
|
59
59
|
|
60
|
-
If there is a situation, where `current_user` might be nil (as is the case during sign up process), you
|
60
|
+
If there is a situation, where `current_user` might be nil (as is the case during sign up process), you can explicitly identify such user after you have a user record created in the database:
|
61
61
|
|
62
62
|
```ruby
|
63
63
|
metrics.identify(user)
|
64
|
-
metrics.track 'Sign
|
64
|
+
metrics.track 'Sign in'
|
65
|
+
```
|
66
|
+
|
67
|
+
|
68
|
+
There's also a method to track selected metrics anonymously (without identifying the user at Mixpanel). This is useful to track page views/site visits:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
metrics.track_anonymously 'Marketing site visit'
|
65
72
|
```
|
66
73
|
|
67
74
|
|
@@ -70,6 +77,8 @@ If there is a situation, where `current_user` might be nil (as is the case durin
|
|
70
77
|
|
71
78
|
Since the actual tracking is happening via client-side javascript calls, there might be a situation, when you track something in the controller, but after that there is a redirect to another website. In such situation the metric might not be recorded properly (it is usually the case with Exvo-Auth and signing in).
|
72
79
|
|
80
|
+
If, however, during the same browser session the user visits the app which did the redirect (i.e. Exvo-Auth), the stored event ('Signing in') will be sent to Mixpanel. After browser restart it is lost.
|
81
|
+
|
73
82
|
|
74
83
|
|
75
84
|
## Contributing
|
data/lib/exvo/metrics.rb
CHANGED
@@ -20,6 +20,11 @@ module Exvo
|
|
20
20
|
metrics_platform.append_track(event_name, properties)
|
21
21
|
end
|
22
22
|
|
23
|
+
# Track things without identifying the user. Useful for page view/site visit trakcing
|
24
|
+
def track_anonymously(event_name, properties = {})
|
25
|
+
metrics_platform.append_track(event_name, properties)
|
26
|
+
end
|
27
|
+
|
23
28
|
def method_missing(method, *args, &block)
|
24
29
|
metrics_platform.public_send(method, *args, &block)
|
25
30
|
end
|
data/lib/exvo/metrics/version.rb
CHANGED
data/spec/exvo/metrics_spec.rb
CHANGED
@@ -38,6 +38,20 @@ describe Exvo::Metrics do
|
|
38
38
|
|
39
39
|
end
|
40
40
|
|
41
|
+
describe '#track_anonymously' do
|
42
|
+
|
43
|
+
before do
|
44
|
+
metrics_platform.should_not_receive(:append_identify)
|
45
|
+
metrics_platform.should_not_receive(:append_set)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'sends tracking request without identifying the user' do
|
49
|
+
metrics_platform.should_receive(:append_track)
|
50
|
+
metrics.track_anonymously('Marketing site visit')
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
41
55
|
it 'forwards all other methods to the metrics platform' do
|
42
56
|
metrics_platform.should_receive(:set_once).with('id')
|
43
57
|
metrics.set_once('id')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exvo-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paweł Gościcki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixpanel
|