Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
モバイルサイトでGoogle Analyticsを利用する
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
robotvert
June 01, 2010
Programming
330
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
モバイルサイトでGoogle Analyticsを利用する
クックパッドでは携帯版のアクセスログの解析について。
robotvert
June 01, 2010
More Decks by robotvert
See All by robotvert
ActionCable and React
robotvert
0
110
About COOKPAD (2013-11)
robotvert
21
5.2k
Pseudo SMT at COOKPAD
robotvert
0
380
Other Decks in Programming
See All in Programming
Android CLI
fornewid
0
200
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
150
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
370
Apache Hive: Toward a Cloud Native Lakehouse
okumin
0
170
php-fpmのプロセスが枯渇した日-調査・対処・そして本当にやるべきだったこと-
shibuchaaaan
0
180
Lean は証明の正しさを確認するためだけのツールって思ってませんか?
inoueasei
1
130
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
510
What's New in Android 2026
veronikapj
0
240
AIエージェントで 変わるAndroid開発環境
takahirom
2
760
yield再入門 #phpcon
o0h
PRO
0
860
今さら聞けない .NET CLI
htkym
0
170
Foundation Models frameworkで画像分析
ryodeveloper
1
320
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
380
Code Reviewing Like a Champion
maltzj
528
40k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
600
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
260
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
200
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.2k
Six Lessons from altMBA
skipperchong
29
4.4k
Utilizing Notion as your number one productivity tool
mfonobong
4
490
Transcript
Mobile Analytics Julien Feltesse
自己紹介 フェルテス ジュリアン @robotvert フランス出身 日本に滞在4年目 最近はKVSとAndroidに興味
1 2 3 Google Analytics COOKPAD Google 1 request to
whatever page 2 requested page + GA javascript 3 sending infos about the request to GA using javascript
携帯はJavascript対応してないので 違う方法が必要
Googleのコード aspx, php, java, perl... no ruby! まずはRubyに変換
1 4 2 Mobile Analytics COOKPAD Google 1 request to
whatever page 2 requested page + img src html tag whose source is on the server 3 requesting the img, passing along some parameters 4 sending infos about the request to GA 4 finally, returning the img itself (1x1 transparent GIF) 5 3
Googleのコード ページに1x1ピクセルの透明GIFを入れる。 <img src=”ga? utmac=ACCOUNT&utmn=RANDOM &utmr=REFERER&utmp=REQUEST_URI”>
Googleのコード サーバー側 •パラメーターからもらった情報の整理 • Visitor id 作成:cookie使うか、uid使うか、UAで ランダムidを作ってる。 • Cookieを送ってみてる。
•集まった情報でGoogleに送るリクエスト作って、 クライアントのUAとAccept-Language使ってサー バーがGoogleにリクエストを送る。 •レスポンスは透明GIFになる。
Googleのコード 問題 • GIF呼び込むとサーバーに2回リクエストする • 携帯は通信が遅い • サーバーの負荷もったいない • syncでサーバーがGAにリクエスト送るので、GA
が遅いまたは落ちた場合は、クライアントに影響 になる。
COOKPADバージョン •とにかくサーバーがパラメーター作ってるので 2回リクエストしなくてもうごく → GIFいらない! •クライアントに影響ないようにしなきゃ
バージョン1 LVSの後ろ、サーバー2台で、Railsのアプリで リクエストの時にforkして、別なプロセスでGAに リクエスト送る事 大失敗 • forkが死ぬほど遅い • その代わりにRails 2.3.5で、MetalやThreadを
使ってもまだまだ遅い
バージョン2 Beanstalk queue serverをインストールして、 appサーバーがGAに送るリクエストをQueueに 入れて、別なサーバーがJavaのアプリでその Queueからタスクとってきて、GAにリクエスト 送る 成功 •
CPUはいつも20%未満 • メモリーリークなし • ピークタイムでも死なない
1 2 3 COOKPAD Analytics COOKPAD Google L V S
Beanstalk queue java Beanstalk queue java
Javaのアプリ とっても簡単: • Master classが起動の時N worker threadsを作成 し、スタートさせる(現在は100 threadsで) •
Worker classが常にQueueの状態を確認して、タ スクがあったら直接GAにリクエスト送る
Javaのアプリ お得なところ • Beanstalkのいいところ:接続キープしてる → threadsがpollingするの必要がない。 • ThreadsがMasterとsyncしないのでsynchronize 系のバグやパフォーマンスの問題がない
Javaのアプリ 簡単なHTTPサーバーを追加してから: • ヘルスチェック可能 • /hello => HTTP 204 •
きれいに止める事が出来る(killしないで) • /shutdown => HTTP 200, stop all workers or exit in 5 secs • すべてのthreadのステータスが見れる • /status => HTTP 200 Worker 009: RUNNABLE | 3182853 completed jobs, 0 failed jobs Worker 010: RUNNABLE | 3183679 completed jobs, 0 failed jobs Worker 011: RUNNABLE | 3182793 completed jobs, 0 failed jobs ...
ありがとうございます icons: http://quantum-bits.org/