Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
モバイルサイトで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
340
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
120
About COOKPAD (2013-11)
robotvert
21
5.2k
Pseudo SMT at COOKPAD
robotvert
0
400
Other Decks in Programming
See All in Programming
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
200
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
210
続・コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions-again
handlename
0
130
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
190
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
4.7k
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
4
1.3k
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
810
AI-Powered Domain-Driven Design
ziobrando
0
320
Next.js: The final boss of Web Performance
guaca
0
340
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.4k
気持ちぃ〜角丸 Squircle
ryu1013
0
340
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
130
Featured
See All Featured
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Skip the Path - Find Your Career Trail
mkilby
1
260
Fireside Chat
paigeccino
43
4.1k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Bash Introduction
62gerente
615
220k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
440
Practical Orchestrator
shlominoach
192
12k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
580
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
360
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/