Upgrade to Pro — share decks privately, control downloads, hide ads and more …

モバイルサイトでGoogle Analyticsを利用する

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

モバイルサイトでGoogle Analyticsを利用する

クックパッドでは携帯版のアクセスログの解析について。

Avatar for robotvert

robotvert

June 01, 2010
Tweet

More Decks by robotvert

Other Decks in Programming

Transcript

  1. 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
  2. 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
  3. Googleのコード サーバー側 •パラメーターからもらった情報の整理 • Visitor id 作成:cookie使うか、uid使うか、UAで ランダムidを作ってる。 • Cookieを送ってみてる。

    •集まった情報でGoogleに送るリクエスト作って、 クライアントのUAとAccept-Language使ってサー バーがGoogleにリクエストを送る。 •レスポンスは透明GIFになる。
  4. 1 2 3 COOKPAD Analytics COOKPAD Google L V S

    Beanstalk queue java Beanstalk queue java
  5. Javaのアプリ とっても簡単: • Master classが起動の時N worker threadsを作成 し、スタートさせる(現在は100 threadsで) •

    Worker classが常にQueueの状態を確認して、タ スクがあったら直接GAにリクエスト送る
  6. 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 ...