greenfinch-ruby 0.1.0 → 0.2.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 +4 -4
- data/README.md +30 -81
- data/lib/greenfinch-ruby/consumer.rb +1 -3
- data/lib/greenfinch-ruby/version.rb +1 -1
- metadata +1 -2
- data/Readme.rdoc +0 -109
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8966188c50fadaf09002b9bddf5d3f6a53b9f96a
|
4
|
+
data.tar.gz: 7f26ec4d2d58b0ea1890c07e94b6954134bac0a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ea6885acfb5c1887e577776474a3ce706d87267bd11efc9a13b9f4c5f95ac1261cf2d81ce77fd37317339ecdd2bf778b47bba54c3605c92f869ae6216790d94
|
7
|
+
data.tar.gz: 91bcc6918d3f27780c05dbdc319125122653c04856627c5ec95f7affcda4ea083729291228a54f5c62aa53801dd20c71e3b51e37649090aec6a7174f0167207c
|
data/README.md
CHANGED
@@ -4,121 +4,70 @@
|
|
4
4
|
한국신용데이터 data lake로 서비스 내 각종 event를 전송하는 ruby library 입니다.
|
5
5
|
|
6
6
|
## 설치하기
|
7
|
-
아래 2가지 방법을 지원합니다. 서비스 환경에 맞는 방법으로 설치하시기 바랍니다.
|
8
|
-
### NPM으로 설치하기
|
9
7
|
```sh
|
10
|
-
|
8
|
+
gem install greenfinch-ruby
|
11
9
|
```
|
12
10
|
|
13
|
-
라이브러리 설치 후 발급받은 토큰와 서비스명으로
|
11
|
+
라이브러리 설치 후 발급받은 토큰와 서비스명으로 tracker 생성 후 track 호출로 이벤트 전송
|
14
12
|
|
15
|
-
```
|
16
|
-
|
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();
|
13
|
+
```ruby
|
14
|
+
tracker = Greenfinch::Tracker.new('<YOUR TOKEN>', '<YOUR SERVICE>', true)
|
15
|
+
tracker.track('<USER ID>', '<EVENT NAME>')
|
39
16
|
```
|
40
17
|
|
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
18
|
## 사용하기
|
59
19
|
___
|
60
|
-
###
|
20
|
+
### Greenfinch::Tracker.new
|
61
21
|
greenfinch object를 초기화 하는 함수입니다. 아래와 같이 초기화 후 사용하시기 바랍니다.
|
62
22
|
|
63
|
-
```
|
64
|
-
|
23
|
+
```ruby
|
24
|
+
tracker = Greenfinch::Tracker.new('<YOUR TOKEN>', '<YOUR SERVICE>', true)
|
65
25
|
```
|
66
26
|
|
67
27
|
| Argument | Type | Description |
|
68
28
|
| ------------- | ------------- | ----- |
|
69
29
|
| **token** | <span class="mp-arg-type">String, </span></br></span><span class="mp-arg-required">required</span> | 부여받은 token |
|
70
|
-
| **
|
71
|
-
| **
|
72
|
-
| **
|
30
|
+
| **service_name** | <span class="mp-arg-type">String, </span></br></span><span class="mp-arg-required">required</span> | 부여받은 service name |
|
31
|
+
| **debug** | <span class="mp-arg-type">Boolean, </span></br></span><span class="mp-arg-required">required</span> | true: staging, false: production |
|
32
|
+
| **error_handler** | <span class="mp-arg-type">Greenfinch::ErrorHandler, </span></br></span><span class="mp-arg-required">optional</span> | error handler |
|
73
33
|
|
74
34
|
|
75
35
|
___
|
76
|
-
###
|
36
|
+
### Greenfinch::Tracker.track
|
77
37
|
custom한 event를 전송하는 함수입니다.
|
78
38
|
|
79
39
|
|
80
|
-
```
|
81
|
-
|
40
|
+
```ruby
|
41
|
+
tracker.track('123456', 'Registered', {Gender: 'Male', Age: 21});
|
82
42
|
```
|
83
43
|
|
84
44
|
| Argument | Type | Description |
|
85
45
|
| ------------- | ------------- | ----- |
|
46
|
+
| **user_id** | <span class="mp-arg-type">String, </span></br></span><span class="mp-arg-required">required</span> | user_id |
|
86
47
|
| **event_name** | <span class="mp-arg-type">String, </span></br></span><span class="mp-arg-required">required</span> | 이벤트 이름 |
|
87
48
|
| **properties** | <span class="mp-arg-type">Object, </span></br></span><span class="mp-arg-optional">optional</span> | 추가적으로 전송할 properties |
|
88
49
|
|
89
50
|
___
|
90
|
-
###
|
91
|
-
|
92
|
-
single page application에서 경로 변경 시 호출되는 listener에 추가하시면 됩니다.
|
51
|
+
### Greenfinch::ErrorHandler
|
52
|
+
Greenfinch 사용 중 발생하는 에러를 처리합니다. Tracker.new 호출 시 인자로 넘겨 사용하시면 됩니다.
|
93
53
|
|
94
|
-
```javascript
|
95
|
-
greenfinch.page();
|
96
|
-
```
|
97
54
|
|
98
|
-
|
99
|
-
|
100
|
-
super properties를 등록하는 함수입니다. 등록 이후 track되는 모든 event에 해당 properties가 추가됩니다. 로그인 성공 직후 유저 정보를 설정하는데 활용 가능합니다.
|
55
|
+
```ruby
|
56
|
+
require 'logger'
|
101
57
|
|
102
|
-
|
103
|
-
greenfinch.register({'user_id': 123456});
|
104
|
-
```
|
58
|
+
class MyErrorHandler < Greenfinch::ErrorHandler
|
105
59
|
|
60
|
+
def initialize
|
61
|
+
@logger = Logger.new('mylogfile.log')
|
62
|
+
@logger.level = Logger::ERROR
|
63
|
+
end
|
106
64
|
|
107
|
-
|
108
|
-
|
109
|
-
|
65
|
+
def handle(error)
|
66
|
+
logger.error "#{error.inspect}\n Backtrace: #{error.backtrace}"
|
67
|
+
end
|
110
68
|
|
111
|
-
|
112
|
-
### greenfinch.unregister
|
113
|
-
super property에 저장되어 있는 항목을 제거하는 함수입니다. 로그아웃 후 유저 정보를 삭제하는데 활용 가능합니다.
|
69
|
+
end
|
114
70
|
|
115
|
-
|
116
|
-
|
71
|
+
my_error_handler = MyErrorHandler.new
|
72
|
+
tracker = Greenfinch::Tracker.new('<YOUR TOKEN>', '<YOUR SERVICE>', true, my_error_handler)
|
117
73
|
```
|
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
|
-
|
@@ -114,9 +114,7 @@ module Greenfinch
|
|
114
114
|
rescue JSON::JSONError
|
115
115
|
raise ServerError.new("Could not interpret Greenfinch server response: '#{response_body}'")
|
116
116
|
end
|
117
|
-
|
118
|
-
|
119
|
-
if result['status'] != 1
|
117
|
+
else
|
120
118
|
raise ServerError.new("Could not write to Greenfinch, server responded with #{response_code} returning: '#{response_body}'")
|
121
119
|
end
|
122
120
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greenfinch-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KoreaCreditData
|
@@ -85,7 +85,6 @@ files:
|
|
85
85
|
- LICENSE
|
86
86
|
- README.md
|
87
87
|
- Rakefile
|
88
|
-
- Readme.rdoc
|
89
88
|
- demo/faraday_consumer.rb
|
90
89
|
- demo/out_of_process_consumer.rb
|
91
90
|
- demo/simple_messages.rb
|
data/Readme.rdoc
DELETED
@@ -1,109 +0,0 @@
|
|
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
|