2015年1月10日 星期六

自動統計 app 在 Google Play 內各版本的的分數和常見問題

最近想統計 app 在 Google Play 上各版的分數,了解最近版本是否比較不穩定。如果有問題的話,統計一下問題分成那幾類。透過 Google Play 觀看 review,如果沒有邊看邊統計分類,看過只會有個模糊印象,不知道那類問題比較嚴重。但是.......又懶得邊看邊記。

為了自動分類 reviews, 首先要抓下 Google Play 上的 review。幸好 Google Play 存放 reviews 和其它資料在 Google Cloud Storage, 並提供工具 gsutil 可以從命令列取出 Google Cloud Storage 的資料, 作起來並不費工。官方說明在這裡的 "Export ratings and reviews"。摘要步驟如下:

1. Mac 或 Linux 下載解開 gsutil:

https://cloud.google.com/storage/docs/gsutil_install

2. 更新、設定 gsutil:

$ export PATH=$PATH:/path/to/gsutil
$ gsutil update
$ gsutil config

其中 gsutil config 會認證帳號, 照著作即可。最後要求輸入 project id 的時候, 輸入 app package name,例如 com.mycompany.myapp。相關說明見這裡

3. 下載 review

從 Google Play App Console -> App -> Ratings & Reviews 最下方得知 reviews 存放的位置

Ratings and reviews are also available for programmatic access through Google Cloud Storage and the gsutil tool. Your data, updated daily, is stored in this private bucket:
pubsite_prod_rev_NUMBER

接著用 gsutil 列出目錄下的檔案

$ gsutil ls gs://pubsite_prod_rev_NUMBER

再來就簡單了,gsutil 用法和 shell 指令差不多,有 ls, cp 之類的。下面的指令會取出所有 reviews 到本機目錄下:

$ data=$(gsutil ls gs://pubsite_prod_rev_NUMBER/reviews/)
$ for f in $data; do gsutil cp $f . ; done

取出來的檔案是每個 app 每個月一份 CSV 檔, 編碼為 UTF-16。

取得 CSV 後,就可以自行寫程式分析了。這裡有我寫的一份簡單版本,將要觀察的 CSV 檔放到同一目錄下,執行 script 帶入目錄名稱,會輸出各版本的分數還有統計最新版 reviews 裡面出現關鍵字 (如 "crash", "freeze" ) 的數量。需要用的話,記得修改 OBSERVERED_WORDS 以符合自己的需求。

沒有留言:

張貼留言

在 Fedora 下裝 id-utils

Fedora 似乎因為執行檔撞名,而沒有提供 id-utils 的套件 ,但這是使用 gj 的必要套件,只好自己編。從官網抓好 tarball ,解開來編譯 (./configure && make)就是了。 但編譯後會遇到錯誤: ./stdio.h:10...