greenfinch-ruby 0.1.0
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 +7 -0
- data/.gitignore +5 -0
- data/.idea/.gitignore +8 -0
- data/.idea/greenfinch-ruby.iml +16 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/Gemfile +2 -0
- data/LICENSE +190 -0
- data/README.md +124 -0
- data/Rakefile +13 -0
- data/Readme.rdoc +109 -0
- data/demo/faraday_consumer.rb +40 -0
- data/demo/out_of_process_consumer.rb +71 -0
- data/demo/simple_messages.rb +9 -0
- data/greenfinch-ruby.gemspec +21 -0
- data/lib/greenfinch-ruby.rb +3 -0
- data/lib/greenfinch-ruby/consumer.rb +271 -0
- data/lib/greenfinch-ruby/error.rb +46 -0
- data/lib/greenfinch-ruby/events.rb +140 -0
- data/lib/greenfinch-ruby/groups.rb +201 -0
- data/lib/greenfinch-ruby/people.rb +254 -0
- data/lib/greenfinch-ruby/tracker.rb +184 -0
- data/lib/greenfinch-ruby/version.rb +3 -0
- data/spec/mixpanel-ruby/consumer_spec.rb +208 -0
- data/spec/mixpanel-ruby/error_spec.rb +76 -0
- data/spec/mixpanel-ruby/events_spec.rb +76 -0
- data/spec/mixpanel-ruby/groups_spec.rb +159 -0
- data/spec/mixpanel-ruby/people_spec.rb +220 -0
- data/spec/mixpanel-ruby/tracker_spec.rb +134 -0
- data/spec/spec_helper.rb +15 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a282134674aace21f7223edad681e2bb60e0eb97
|
4
|
+
data.tar.gz: 49d76e99de2d64ba4f74807f473ff0f158e3822c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 836fb53b5efa265f2140d07f67b2e6b9f76efa2f411e9c4c2aae6c15dfe4b5f9058017e02842d512d32b50d38e4f48a95dcb71a267d57dc53a734b89a7929728
|
7
|
+
data.tar.gz: d2be292b934128ee61e7bede3048abc67498cc756b831cafbdd9abcaf5a04d7d03329c9e8792670e4461c07ba05805569534e8b905a095d90d3aeaec59148866
|
data/.gitignore
ADDED
data/.idea/.gitignore
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
</content>
|
12
|
+
<orderEntry type="inheritedJdk" />
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, ruby-2.3.7-p456) [gem]" level="application" />
|
15
|
+
</component>
|
16
|
+
</module>
|
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/greenfinch-ruby.iml" filepath="$PROJECT_DIR$/.idea/greenfinch-ruby.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
Copyright 2012 Mixpanel, Inc.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this work except in compliance with the License.
|
5
|
+
You may obtain a copy of the License below, or at:
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
|
15
|
+
Apache License
|
16
|
+
Version 2.0, January 2004
|
17
|
+
http://www.apache.org/licenses/
|
18
|
+
|
19
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
20
|
+
|
21
|
+
1. Definitions.
|
22
|
+
|
23
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
24
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
25
|
+
|
26
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
27
|
+
the copyright owner that is granting the License.
|
28
|
+
|
29
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
30
|
+
other entities that control, are controlled by, or are under common
|
31
|
+
control with that entity. For the purposes of this definition,
|
32
|
+
"control" means (i) the power, direct or indirect, to cause the
|
33
|
+
direction or management of such entity, whether by contract or
|
34
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
35
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
36
|
+
|
37
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
38
|
+
exercising permissions granted by this License.
|
39
|
+
|
40
|
+
"Source" form shall mean the preferred form for making modifications,
|
41
|
+
including but not limited to software source code, documentation
|
42
|
+
source, and configuration files.
|
43
|
+
|
44
|
+
"Object" form shall mean any form resulting from mechanical
|
45
|
+
transformation or translation of a Source form, including but
|
46
|
+
not limited to compiled object code, generated documentation,
|
47
|
+
and conversions to other media types.
|
48
|
+
|
49
|
+
"Work" shall mean the work of authorship, whether in Source or
|
50
|
+
Object form, made available under the License, as indicated by a
|
51
|
+
copyright notice that is included in or attached to the work
|
52
|
+
(an example is provided in the Appendix below).
|
53
|
+
|
54
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
55
|
+
form, that is based on (or derived from) the Work and for which the
|
56
|
+
editorial revisions, annotations, elaborations, or other modifications
|
57
|
+
represent, as a whole, an original work of authorship. For the purposes
|
58
|
+
of this License, Derivative Works shall not include works that remain
|
59
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
60
|
+
the Work and Derivative Works thereof.
|
61
|
+
|
62
|
+
"Contribution" shall mean any work of authorship, including
|
63
|
+
the original version of the Work and any modifications or additions
|
64
|
+
to that Work or Derivative Works thereof, that is intentionally
|
65
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
66
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
67
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
68
|
+
means any form of electronic, verbal, or written communication sent
|
69
|
+
to the Licensor or its representatives, including but not limited to
|
70
|
+
communication on electronic mailing lists, source code control systems,
|
71
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
72
|
+
Licensor for the purpose of discussing and improving the Work, but
|
73
|
+
excluding communication that is conspicuously marked or otherwise
|
74
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
75
|
+
|
76
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
77
|
+
on behalf of whom a Contribution has been received by Licensor and
|
78
|
+
subsequently incorporated within the Work.
|
79
|
+
|
80
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
81
|
+
this License, each Contributor hereby grants to You a perpetual,
|
82
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
83
|
+
copyright license to reproduce, prepare Derivative Works of,
|
84
|
+
publicly display, publicly perform, sublicense, and distribute the
|
85
|
+
Work and such Derivative Works in Source or Object form.
|
86
|
+
|
87
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
88
|
+
this License, each Contributor hereby grants to You a perpetual,
|
89
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
90
|
+
(except as stated in this section) patent license to make, have made,
|
91
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
92
|
+
where such license applies only to those patent claims licensable
|
93
|
+
by such Contributor that are necessarily infringed by their
|
94
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
95
|
+
with the Work to which such Contribution(s) was submitted. If You
|
96
|
+
institute patent litigation against any entity (including a
|
97
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
98
|
+
or a Contribution incorporated within the Work constitutes direct
|
99
|
+
or contributory patent infringement, then any patent licenses
|
100
|
+
granted to You under this License for that Work shall terminate
|
101
|
+
as of the date such litigation is filed.
|
102
|
+
|
103
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
104
|
+
Work or Derivative Works thereof in any medium, with or without
|
105
|
+
modifications, and in Source or Object form, provided that You
|
106
|
+
meet the following conditions:
|
107
|
+
|
108
|
+
(a) You must give any other recipients of the Work or
|
109
|
+
Derivative Works a copy of this License; and
|
110
|
+
|
111
|
+
(b) You must cause any modified files to carry prominent notices
|
112
|
+
stating that You changed the files; and
|
113
|
+
|
114
|
+
(c) You must retain, in the Source form of any Derivative Works
|
115
|
+
that You distribute, all copyright, patent, trademark, and
|
116
|
+
attribution notices from the Source form of the Work,
|
117
|
+
excluding those notices that do not pertain to any part of
|
118
|
+
the Derivative Works; and
|
119
|
+
|
120
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
121
|
+
distribution, then any Derivative Works that You distribute must
|
122
|
+
include a readable copy of the attribution notices contained
|
123
|
+
within such NOTICE file, excluding those notices that do not
|
124
|
+
pertain to any part of the Derivative Works, in at least one
|
125
|
+
of the following places: within a NOTICE text file distributed
|
126
|
+
as part of the Derivative Works; within the Source form or
|
127
|
+
documentation, if provided along with the Derivative Works; or,
|
128
|
+
within a display generated by the Derivative Works, if and
|
129
|
+
wherever such third-party notices normally appear. The contents
|
130
|
+
of the NOTICE file are for informational purposes only and
|
131
|
+
do not modify the License. You may add Your own attribution
|
132
|
+
notices within Derivative Works that You distribute, alongside
|
133
|
+
or as an addendum to the NOTICE text from the Work, provided
|
134
|
+
that such additional attribution notices cannot be construed
|
135
|
+
as modifying the License.
|
136
|
+
|
137
|
+
You may add Your own copyright statement to Your modifications and
|
138
|
+
may provide additional or different license terms and conditions
|
139
|
+
for use, reproduction, or distribution of Your modifications, or
|
140
|
+
for any such Derivative Works as a whole, provided Your use,
|
141
|
+
reproduction, and distribution of the Work otherwise complies with
|
142
|
+
the conditions stated in this License.
|
143
|
+
|
144
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
145
|
+
any Contribution intentionally submitted for inclusion in the Work
|
146
|
+
by You to the Licensor shall be under the terms and conditions of
|
147
|
+
this License, without any additional terms or conditions.
|
148
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
149
|
+
the terms of any separate license agreement you may have executed
|
150
|
+
with Licensor regarding such Contributions.
|
151
|
+
|
152
|
+
6. Trademarks. This License does not grant permission to use the trade
|
153
|
+
names, trademarks, service marks, or product names of the Licensor,
|
154
|
+
except as required for reasonable and customary use in describing the
|
155
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
156
|
+
|
157
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
158
|
+
agreed to in writing, Licensor provides the Work (and each
|
159
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
160
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
161
|
+
implied, including, without limitation, any warranties or conditions
|
162
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
163
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
164
|
+
appropriateness of using or redistributing the Work and assume any
|
165
|
+
risks associated with Your exercise of permissions under this License.
|
166
|
+
|
167
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
168
|
+
whether in tort (including negligence), contract, or otherwise,
|
169
|
+
unless required by applicable law (such as deliberate and grossly
|
170
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
171
|
+
liable to You for damages, including any direct, indirect, special,
|
172
|
+
incidental, or consequential damages of any character arising as a
|
173
|
+
result of this License or out of the use or inability to use the
|
174
|
+
Work (including but not limited to damages for loss of goodwill,
|
175
|
+
work stoppage, computer failure or malfunction, or any and all
|
176
|
+
other commercial damages or losses), even if such Contributor
|
177
|
+
has been advised of the possibility of such damages.
|
178
|
+
|
179
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
180
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
181
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
182
|
+
or other liability obligations and/or rights consistent with this
|
183
|
+
License. However, in accepting such obligations, You may act only
|
184
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
185
|
+
of any other Contributor, and only if You agree to indemnify,
|
186
|
+
defend, and hold each Contributor harmless for any liability
|
187
|
+
incurred by, or claims asserted against, such Contributor by reason
|
188
|
+
of your accepting any such warranty or additional liability.
|
189
|
+
|
190
|
+
END OF TERMS AND CONDITIONS
|
data/README.md
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
# GreenFinch Ruby Library
|
2
|
+

|
3
|
+
|
4
|
+
한국신용데이터 data lake로 서비스 내 각종 event를 전송하는 ruby library 입니다.
|
5
|
+
|
6
|
+
## 설치하기
|
7
|
+
아래 2가지 방법을 지원합니다. 서비스 환경에 맞는 방법으로 설치하시기 바랍니다.
|
8
|
+
### NPM으로 설치하기
|
9
|
+
```sh
|
10
|
+
npm install --save greenfinch
|
11
|
+
```
|
12
|
+
|
13
|
+
라이브러리 설치 후 발급받은 토큰와 서비스명으로 init후 track 호출로 이벤트 전송
|
14
|
+
|
15
|
+
```javascript
|
16
|
+
import greenfinch from 'greenfinch';
|
17
|
+
|
18
|
+
greenfinch.init('<YOUR TOKEN>', {'service_name': '<YOUR SERVICE>', 'debug':true});
|
19
|
+
greenfinch.track("An event");
|
20
|
+
```
|
21
|
+
|
22
|
+
### Javascript snippet으로 설치하기
|
23
|
+
아래 snippet을 발급받은 토큰와 서비스명으로 치환 후 `<head></head>` 사이에 붙어넣기
|
24
|
+
```html
|
25
|
+
<script>window.GREENFINCH_CUSTOM_LIB_URL = 'https://asset.kcd.co.kr/js/greenfinch.min.js';</script>
|
26
|
+
<script src="https://asset.kcd.co.kr/js/greenfinch-jslib-snippet.min.js"></script>
|
27
|
+
<script type="text/javascript">greenfinch.init("<YOUR TOKEN>", {'service_name':'<YOUR SERVICE>', 'debug': true});</script>
|
28
|
+
```
|
29
|
+
|
30
|
+
## 기능
|
31
|
+
### autotrack
|
32
|
+
- page load시 pageview 이벤트가 자동으로 전송
|
33
|
+
- dom click시 click 이벤트가 자동으로 전송
|
34
|
+
|
35
|
+
### single page application
|
36
|
+
- spa에서는 경로 변경 시 page load가 일어나지 않기 때문에 pageview 이벤트를 자동 전송하려면 page 변경 listener에 아래 코드 추가 필요
|
37
|
+
```javascript
|
38
|
+
greenfinch.page();
|
39
|
+
```
|
40
|
+
|
41
|
+
### 기본 수집 컬럼
|
42
|
+
- browser_name
|
43
|
+
- browser_version
|
44
|
+
- current_url
|
45
|
+
- host
|
46
|
+
- referrer
|
47
|
+
- insert_id(unique_id)
|
48
|
+
- lib_version
|
49
|
+
- os
|
50
|
+
- pathname
|
51
|
+
- screen_height
|
52
|
+
- screen_width
|
53
|
+
- title
|
54
|
+
- session_id
|
55
|
+
- time
|
56
|
+
- utm_source, utm_medium, utm_campaign, utm_content, utm_term
|
57
|
+
|
58
|
+
## 사용하기
|
59
|
+
___
|
60
|
+
### greenfinch.init
|
61
|
+
greenfinch object를 초기화 하는 함수입니다. 아래와 같이 초기화 후 사용하시기 바랍니다.
|
62
|
+
|
63
|
+
```javascript
|
64
|
+
greenfinch.init('<YOUR TOKEN>', {'service_name': '<YOUR SERVICE>', 'debug':true or false});
|
65
|
+
```
|
66
|
+
|
67
|
+
| Argument | Type | Description |
|
68
|
+
| ------------- | ------------- | ----- |
|
69
|
+
| **token** | <span class="mp-arg-type">String, </span></br></span><span class="mp-arg-required">required</span> | 부여받은 token |
|
70
|
+
| **config** | <span class="mp-arg-type">Object, </span></br></span><span class="mp-arg-required">required</span> | 초기화 시 필요한 config|
|
71
|
+
| **options.service_name** | <span class="mp-arg-type">String, </span></br></span><span class="mp-arg-required">required</span> | 부여받은 service name |
|
72
|
+
| **options.debug** | <span class="mp-arg-type">Boolean, </span></br></span><span class="mp-arg-required">required</span> | true: staging, false: production |
|
73
|
+
|
74
|
+
|
75
|
+
___
|
76
|
+
### greenfinch.track
|
77
|
+
custom한 event를 전송하는 함수입니다.
|
78
|
+
|
79
|
+
|
80
|
+
```javascript
|
81
|
+
greenfinch.track('Registered', {'Gender': 'Male', 'Age': 21});
|
82
|
+
```
|
83
|
+
|
84
|
+
| Argument | Type | Description |
|
85
|
+
| ------------- | ------------- | ----- |
|
86
|
+
| **event_name** | <span class="mp-arg-type">String, </span></br></span><span class="mp-arg-required">required</span> | 이벤트 이름 |
|
87
|
+
| **properties** | <span class="mp-arg-type">Object, </span></br></span><span class="mp-arg-optional">optional</span> | 추가적으로 전송할 properties |
|
88
|
+
|
89
|
+
___
|
90
|
+
### greenfinch.page
|
91
|
+
pageview event를 전송하는 함수입니다.
|
92
|
+
single page application에서 경로 변경 시 호출되는 listener에 추가하시면 됩니다.
|
93
|
+
|
94
|
+
```javascript
|
95
|
+
greenfinch.page();
|
96
|
+
```
|
97
|
+
|
98
|
+
___
|
99
|
+
### greenfinch.register
|
100
|
+
super properties를 등록하는 함수입니다. 등록 이후 track되는 모든 event에 해당 properties가 추가됩니다. 로그인 성공 직후 유저 정보를 설정하는데 활용 가능합니다.
|
101
|
+
|
102
|
+
```javascript
|
103
|
+
greenfinch.register({'user_id': 123456});
|
104
|
+
```
|
105
|
+
|
106
|
+
|
107
|
+
| Argument | Type | Description |
|
108
|
+
| ------------- | ------------- | ----- |
|
109
|
+
| **properties** | <span class="mp-arg-type">Object, </span></br></span><span class="mp-arg-required">required</span> | 저장하려고 하는 properties |
|
110
|
+
|
111
|
+
___
|
112
|
+
### greenfinch.unregister
|
113
|
+
super property에 저장되어 있는 항목을 제거하는 함수입니다. 로그아웃 후 유저 정보를 삭제하는데 활용 가능합니다.
|
114
|
+
|
115
|
+
```javascript
|
116
|
+
greenfinch.unregister('user_id');
|
117
|
+
```
|
118
|
+
|
119
|
+
|
120
|
+
| Argument | Type | Description |
|
121
|
+
| ------------- | ------------- | ----- |
|
122
|
+
| **property** | <span class="mp-arg-type">String, </span></br></span><span class="mp-arg-required">required</span> | 삭제하려고 하는 property name |
|
123
|
+
|
124
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rspec/core/rake_task'
|
2
|
+
require 'rdoc/task'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
5
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
6
|
+
end
|
7
|
+
|
8
|
+
Rake::RDocTask.new do |rd|
|
9
|
+
rd.main = "Readme.rdoc"
|
10
|
+
rd.rdoc_files.include("Readme.rdoc", "lib/**/*.rb")
|
11
|
+
end
|
12
|
+
|
13
|
+
task :default => :spec
|
data/Readme.rdoc
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
{<img src="https://travis-ci.org/mixpanel/mixpanel-ruby.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/mixpanel/mixpanel-ruby]
|
2
|
+
|
3
|
+
= mixpanel-ruby: The official Mixpanel Ruby library
|
4
|
+
|
5
|
+
mixpanel-ruby is a library for tracking events and sending \Mixpanel profile
|
6
|
+
updates to \Mixpanel from your ruby applications.
|
7
|
+
|
8
|
+
== Installation
|
9
|
+
|
10
|
+
gem install mixpanel-ruby
|
11
|
+
|
12
|
+
== Getting Started
|
13
|
+
|
14
|
+
require 'mixpanel-ruby'
|
15
|
+
|
16
|
+
tracker = Mixpanel::Tracker.new(YOUR_MIXPANEL_TOKEN)
|
17
|
+
|
18
|
+
# Track an event on behalf of user "User1"
|
19
|
+
tracker.track('User1', 'A Mixpanel Event')
|
20
|
+
|
21
|
+
# Send an update to User1's profile
|
22
|
+
tracker.people.set('User1', {
|
23
|
+
'$first_name' => 'David',
|
24
|
+
'$last_name' => 'Bowie',
|
25
|
+
'Best Album' => 'The Rise and Fall of Ziggy Stardust and the Spiders from Mars'
|
26
|
+
})
|
27
|
+
|
28
|
+
The primary class you will use to track events is Mixpanel::Tracker. An instance of
|
29
|
+
Mixpanel::Tracker is enough to send events directly to \Mixpanel, and get you integrated
|
30
|
+
right away.
|
31
|
+
|
32
|
+
== Additional Information
|
33
|
+
|
34
|
+
For more information please visit:
|
35
|
+
|
36
|
+
* Our Ruby API Integration page[https://mixpanel.com/help/reference/ruby#introduction]
|
37
|
+
* The usage demo[https://github.com/mixpanel/mixpanel-ruby/tree/master/demo]
|
38
|
+
* The documentation[http://mixpanel.github.io/mixpanel-ruby/]
|
39
|
+
|
40
|
+
The official Mixpanel gem is built with simplicity and broad applicability in
|
41
|
+
mind, but there are also third party Ruby libraries that can work with the library
|
42
|
+
to provide useful features in common situations, and support different development
|
43
|
+
points of view.
|
44
|
+
|
45
|
+
In particular, for Rails apps, the following projects are currently actively maintained:
|
46
|
+
|
47
|
+
* MetaEvents[https://github.com/swiftype/meta_events]
|
48
|
+
* Mengpaneel[https://github.com/DouweM/mengpaneel]
|
49
|
+
|
50
|
+
== Changes
|
51
|
+
|
52
|
+
== 2.2.2
|
53
|
+
* Add Group Analytics support with Mixpanel::Groups
|
54
|
+
|
55
|
+
== 2.2.1
|
56
|
+
* Fix buffer clearing on partially successful writes in BufferedConsumer.
|
57
|
+
|
58
|
+
== 2.2.0
|
59
|
+
* Add Mixpanel::ErrorHandler to simplify custom error handling.
|
60
|
+
* Modify Mixpanel::People#fix_property_dates to handle ActiveSupport::TimeWithZone.
|
61
|
+
* Increase open and ssl timeouts from 2s to 10s.
|
62
|
+
* Fix Doc inconsistancy: always pass token on Mixpanel::tracker.new.
|
63
|
+
|
64
|
+
== 2.1.0
|
65
|
+
* Add Mixpanel::Tracker#generate_tracking_url, which generates {pixel tracking urls}[https://mixpanel.com/docs/api-documentation/pixel-based-event-tracking].
|
66
|
+
* Rescue JSONErrors in the consumer and raise Mixpanel::ServerError in Mixpanel::Consumer#send!.
|
67
|
+
* Make it clear how to import events with custom timestamp.
|
68
|
+
* Update dependancies in gemspec
|
69
|
+
|
70
|
+
== 2.0.1
|
71
|
+
* Add Deprecated version of Mixpanel::BufferedConsumer#send
|
72
|
+
|
73
|
+
== 2.0.0
|
74
|
+
* Raise mixpanel server and connection errors in Mixpanel::Consumer.
|
75
|
+
* All public methods in Mixpanel::Event, Mixpanel::People, and subsequently Mixpanel::Tracker
|
76
|
+
rescue Mixpanel errors and return false in the case of an error, return true otherwise
|
77
|
+
* Deprecate Mixpanel::Consumer#send, replace with Mixpanel::Consumer#send!
|
78
|
+
* Require ruby version minimum of 2.0.0
|
79
|
+
|
80
|
+
== 1.4.0
|
81
|
+
* Allow unset to unset multiple properties
|
82
|
+
|
83
|
+
== 1.3.0
|
84
|
+
* Added Consumer#request method, demo with Faraday integration
|
85
|
+
|
86
|
+
== 1.2.0
|
87
|
+
* All objects with a "strftime" method will be formatted as dates in
|
88
|
+
people updates.
|
89
|
+
|
90
|
+
== 1.1.0
|
91
|
+
* The default consumer now sends requests (and expects responses) in
|
92
|
+
verbose, JSON mode, which may improve error reporting.
|
93
|
+
|
94
|
+
=== 1.0.2
|
95
|
+
* Allow ip and optional_params arguments to be accepted by all
|
96
|
+
Mixpanel::People methods (except #destroy_user)
|
97
|
+
|
98
|
+
=== 1.0.1
|
99
|
+
* Compatibility with earlier versions of ruby. Library development will continue
|
100
|
+
to target 1.9, so later versions may not be compatible with Ruby 1.8, but we
|
101
|
+
love patches!
|
102
|
+
|
103
|
+
=== 1.0.0
|
104
|
+
* tracker#import added
|
105
|
+
* Change to internal tracking message format. Messages written
|
106
|
+
by earlier versions of the library will not work with 1.0.0 consumer classes.
|
107
|
+
* alias bugfixed
|
108
|
+
* Fixes to tests to allow for different timezones
|
109
|
+
* Support for optional/experimental people api properties in people calls
|