Google Play Store
Elton lấy các báo cáo mà Google Play Console xuất hằng tháng ra Google Cloud Storage: lượt cài đặt (installs), lỗi crash, điểm đánh giá (ratings), đánh giá của người dùng (reviews), hiệu quả trang cửa hàng (store performance) và gói đăng ký (subscriptions). Elton đọc các file CSV này bằng một service account của Google Cloud; danh sách app được đọc qua Google Play Developer Reporting API. Elton chỉ đọc, không thay đổi gì trên Play Console.
Source này không dùng đăng nhập Google (OAuth): bạn dán khoá JSON của service account và nhập bucket chứa báo cáo.
Tóm tắt:
| Mục | Giá trị |
|---|---|
| Loại source trong Elton | Google Play Store |
| Xác thực | Khoá JSON của service account (JSON Credentials) và bucket báo cáo của Play Console (Authorized bucket ID) |
| Mỗi connection | Một hoặc nhiều app, một hoặc nhiều nhóm báo cáo |
| Bảng | Mỗi báo cáo một bảng, tên cố định dạng google_play_store_<báo cáo>_<chiều> (xem mục 4) |
| Cách lấy | Lần đầu: mọi tháng có trong bucket. Các lần sau: mọi file của năm hiện tại |
1. Chuẩn bị trên Google Cloud và Play Console
Theo hướng dẫn của Google (Download and export monthly reports):
- Lấy bucket báo cáo. Trong Play Console, vào Manage account → Play apps reports, bấm Copy Cloud Storage URI cạnh tên mục báo cáo. URI có dạng
gs://pubsite_prod_rev_01234567890987654321/.... Phần saugs://đến dấu/đầu tiên là bucket ID, ví dụpubsite_prod_rev_01234567890987654321. - Tạo service account trong một project Google Cloud, và tạo khoá dạng JSON cho service account đó. Bật Google Play Developer Reporting API cho project, vì Elton đọc danh sách app qua API này.
- Cấp quyền cho service account trên Play Console. Vào Manage account → Users and permissions, nhập email của service account (trường
client_emailtrong file JSON), chọn quyền, rồi bấm Add user. Theo Google, báo cáo thống kê cần quyền "View app information" ở mức Global; báo cáo tài chính (gồm subscriptions) cần thêm "View financial data" ở mức Global.
Quyền mới cấp trên Play Console có thể mất thời gian mới có hiệu lực. Form tạo source của Elton cũng ghi chú: If the connection test fails, this is likely due to the synchronization delay from the Google Play Console. Wait 24 hours, then test the connection again.
2. Tạo data source
- Vào Data Sources → Create data source, ở ô Type chọn Google Play Store.
- Điền form:
| Trường | Giá trị |
|---|---|
| Name | Tên hiển thị của source, ví dụ Elton Play Store |
| Description | Mô tả, không bắt buộc |
| JSON Credentials | Bắt buộc. Dán toàn bộ nội dung file khoá JSON của service account (mục 1) |
| Authorized bucket ID | Bắt buộc. Tên bucket báo cáo, ví dụ pubsite_prod_rev_01234567890987654321. Nhập không có gs:// và không có đường dẫn thư mục phía sau: khi chạy, Elton dùng giá trị này nguyên văn làm tên bucket |
- Bấm Test connection để kiểm tra service account đọc được bucket. Kết quả
Connected successfully!là đạt. - Bấm Create data source. Elton mở trang chi tiết của source vừa tạo.
Ở trang chi tiết, mục Apps available to connections liệt kê các app mà service account thấy được, dạng <tên app> (apps/<package name>). Nếu không có app nào, trang hiện Found no associated apps with these credentials: kiểm tra quyền trên Play Console và API ở mục 1.
Khi sửa data source, ô JSON Credentials hiện giá trị đã được che. Để nguyên thì Elton giữ khoá cũ; Test connection khi đó kiểm tra bằng khoá đã lưu.
3. Tạo connection
Khi tạo connection với source Google Play Store, phần cấu hình source có các trường:
| Trường | Ý nghĩa |
|---|---|
| Select apps | Bắt buộc. Các app cần lấy, dạng <tên app> (apps/<package name>). Dữ liệu mọi app vào chung bảng, phân biệt bằng cột package_name |
| Select reports | Bắt buộc. Các thư mục báo cáo có trong bucket, ví dụ stats/installs, stats/crashes, reviews. Mỗi lựa chọn có thể tạo nhiều bảng (xem mục 4) |
Không có ô ngày bắt đầu hay số ngày lấy lại: Elton đọc theo file tháng (xem Cách Elton lấy dữ liệu).
Select reports liệt kê mọi thư mục Elton tìm thấy trong bucket (tối đa 2 cấp), kể cả những thư mục Elton không hỗ trợ (ví dụ báo cáo doanh thu). Elton chỉ tạo bảng cho các thư mục stats/installs, stats/crashes, stats/ratings, stats/subscriptions, stats/store_performance và reviews. Chọn thư mục khác thì không có bảng nào được tạo và lần chạy không báo lỗi.
Thông báo khi lưu connection thiếu trường: Please select at least 1 app, Please select at least 1 report.
Cách Elton lấy dữ liệu
Play Console ghi mỗi báo cáo thành một file CSV cho mỗi app, mỗi tháng (và mỗi chiều phân tích), ví dụ stats/installs/installs_com.example.app_202510_country.csv. Elton tải các file này từ bucket:
| Lần chạy | File được đọc |
|---|---|
| Lần đầu, hoặc Full reload | Mọi tháng có trong bucket |
| Các lần sau | Mọi file của năm hiện tại (theo giờ UTC). Riêng tháng 1: cả năm trước và năm hiện tại, để lấy đủ tháng 12 |
| Partial reload | Như các lần sau: khoảng ngày bạn chọn không được dùng |
Mỗi lần chạy thường đọc lại toàn bộ file của năm, và ghi kiểu Merge (mặc định) theo khoá của từng bảng, nên số liệu Google cập nhật lại trong file tháng được thay vào dòng cũ, không bị nhân đôi.
Tên cột lấy từ dòng tiêu đề của file CSV, đổi sang chữ thường nối bằng _ (ví dụ Package Name thành package_name, Country / Region thành country_region). File của Google mã hoá UTF-16; Elton tự đọc đúng mã hoá. Mỗi dòng có thêm cột elton_created_at (thời điểm Elton lấy dòng); trên BigQuery cột này chỉ được ghi khi connection dùng kiểu ghi Append, với Merge và Overwrite bảng ở BigQuery không có cột này.
4. Dữ liệu được đồng bộ
Tên bảng cố định, dạng google_play_store_<thư mục báo cáo>_<chiều>, với / trong tên thư mục đổi thành _. Bảng không có hậu tố theo source: nhiều connection Google Play Store ghi vào cùng dataset thì dùng chung bảng, phân biệt app bằng cột package_name. Nếu phần cài đặt destination của connection (Choose my own settings) có ô Table name suffix và bạn điền ô này, Elton thêm _<suffix> vào cuối tên mọi bảng của connection, ví dụ google_play_store_reviews_<suffix>.
Chọn một thư mục báo cáo thì Elton tạo mọi bảng của thư mục đó trong bảng dưới (mỗi chiều phân tích một bảng).
| Báo cáo (Select reports) | Bảng | Khoá | Partition theo ngày |
|---|---|---|---|
stats/installs | google_play_store_stats_installs_overview | package_name, date | date |
google_play_store_stats_installs_app_version | package_name, date, app_version_code | date | |
google_play_store_stats_installs_carrier | package_name, date, carrier | date | |
google_play_store_stats_installs_country | package_name, date, country | date | |
google_play_store_stats_installs_device | package_name, date, device | date | |
google_play_store_stats_installs_language | package_name, date, language | date | |
google_play_store_stats_installs_os_version | package_name, date, android_os_version | date | |
stats/crashes | google_play_store_stats_crashes_overview | package_name, date | date |
google_play_store_stats_crashes_app_version | package_name, date, app_version_code | date | |
google_play_store_stats_crashes_device | package_name, date, device | date | |
google_play_store_stats_crashes_os_version | package_name, date, android_os_version | date | |
stats/ratings | google_play_store_stats_ratings_overview | package_name, date | date |
google_play_store_stats_ratings_app_version | package_name, date, app_version_code | date | |
google_play_store_stats_ratings_carrier | package_name, date, carrier | date | |
google_play_store_stats_ratings_country | package_name, date, country | date | |
google_play_store_stats_ratings_device | package_name, date, device | date | |
google_play_store_stats_ratings_language | package_name, date, language | date | |
google_play_store_stats_ratings_os_version | package_name, date, android_os_version | date | |
stats/subscriptions | google_play_store_stats_subscriptions_country | package_name, date, country | date |
stats/store_performance | google_play_store_stats_store_performance_country | package_name, date, country_region | date |
google_play_store_stats_store_performance_traffic_source | package_name, date, traffic_source, search_term, utm_source, utm_campaign | date | |
reviews | google_play_store_reviews | package_name, app_version_code, review_submit_date_and_time, review_title, review_link | review_submit_date_and_time |
Elton tìm file theo tên: <tên báo cáo>_<package name>_<năm tháng>_<chiều>.csv trong thư mục báo cáo (với reviews: reviews_<package name>_<năm tháng>.csv). Chiều nào không có file trong bucket thì bảng đó không có dữ liệu.
Cột của các bảng Google Play Store
Elton giữ mọi cột có trong file CSV của Google, chỉ đổi tên cột như ở mục 3. Danh sách cột đầy đủ của từng báo cáo do Google định nghĩa, xem ở trang mô tả báo cáo của Google. Các cột Elton dùng làm khoá, có ở mọi file tương ứng:
| Cột | Có ở bảng | Ý nghĩa |
|---|---|---|
package_name | Mọi bảng | Package name của app, ví dụ com.example.app. Dùng để tách số liệu từng app |
date | Mọi bảng trừ google_play_store_reviews | Ngày của số liệu |
app_version_code | google_play_store_stats_installs_app_version, google_play_store_stats_crashes_app_version, google_play_store_stats_ratings_app_version, google_play_store_reviews | Mã phiên bản app (version code) |
carrier | google_play_store_stats_installs_carrier, google_play_store_stats_ratings_carrier | Nhà mạng |
country | google_play_store_stats_installs_country, google_play_store_stats_ratings_country, google_play_store_stats_subscriptions_country | Quốc gia |
country_region | google_play_store_stats_store_performance_country | Quốc gia / khu vực |
device | google_play_store_stats_installs_device, google_play_store_stats_crashes_device, google_play_store_stats_ratings_device | Thiết bị |
language | google_play_store_stats_installs_language, google_play_store_stats_ratings_language | Ngôn ngữ |
android_os_version | google_play_store_stats_installs_os_version, google_play_store_stats_crashes_os_version, google_play_store_stats_ratings_os_version | Phiên bản Android |
traffic_source, search_term, utm_source, utm_campaign | google_play_store_stats_store_performance_traffic_source | Nguồn truy cập trang cửa hàng, từ khoá tìm kiếm, và tham số UTM |
review_submit_date_and_time, review_title, review_link | google_play_store_reviews | Thời điểm gửi đánh giá, tiêu đề, đường dẫn đến đánh giá |
elton_created_at | Mọi bảng | Thời điểm Elton lấy dòng (chỉ có trên BigQuery khi kiểu ghi là Append) |
Elton chỉ đọc báo cáo gói đăng ký trong thư mục stats/subscriptions. Nếu bucket của bạn để báo cáo này ở thư mục khác (ví dụ financial-stats/subscriptions), thư mục đó không được hỗ trợ và bảng google_play_store_stats_subscriptions_country không có dữ liệu.
5. Quan hệ giữa các bảng
Các bảng Google Play Store (trừ google_play_store_reviews) nối với nhau qua package_name và date. Bảng có đuôi _overview (ví dụ google_play_store_stats_installs_overview) là số liệu cả app trong ngày; các bảng cùng báo cáo nhưng đuôi khác (ví dụ google_play_store_stats_installs_country) chia số liệu đó theo một chiều.
| Bảng | Nối với bảng | Điều kiện nối | Quan hệ |
|---|---|---|---|
google_play_store_stats_installs_overview | google_play_store_stats_installs_country (và các bảng chiều khác của installs) | package_name = package_name và date = date | 1 app-ngày – nhiều dòng (mỗi quốc gia, thiết bị… một dòng) |
google_play_store_stats_installs_overview | google_play_store_stats_crashes_overview | package_name = package_name và date = date | 1 – 1 |
google_play_store_stats_installs_overview | google_play_store_stats_ratings_overview | package_name = package_name và date = date | 1 – 1 |
google_play_store_stats_installs_app_version | google_play_store_stats_crashes_app_version | package_name = package_name, date = date và app_version_code = app_version_code | 1 – 1 |
google_play_store_stats_installs_app_version | google_play_store_reviews | package_name = package_name và app_version_code = app_version_code | 1 phiên bản – nhiều đánh giá |
google_play_store_stats_installs_country | google_play_store_stats_store_performance_country | package_name = package_name, date = date và country = country_region | 1 – 1, nếu Google dùng cùng mã quốc gia ở hai báo cáo |
Ví dụ trên BigQuery, so sánh số liệu installs và crashes theo ngày của một app (dùng SELECT * vì cột số liệu do Google đặt tên):
SELECT i.*, c.* EXCEPT (package_name, date)
FROM `dataset.google_play_store_stats_installs_overview` i
LEFT JOIN `dataset.google_play_store_stats_crashes_overview` c
ON c.package_name = i.package_name
AND c.date = i.date
WHERE i.package_name = 'com.example.app'
ORDER BY i.date;
6. Lỗi thường gặp
| Lỗi | Nguyên nhân và cách xử lý |
|---|---|
JSON Credentials is required! hoặc Authorized Bucket ID is required! | Chưa nhập trường bắt buộc khi tạo source (mục 2). |
Invalid service account content (khi Test connection) | Nội dung dán vào JSON Credentials không phải JSON hợp lệ. Dán lại toàn bộ file khoá. |
Missing Google Cloud Storage permissions. hoặc Failed while connecting to Google Cloud Storage! Please check permissions again! | Service account không đọc được bucket. Kiểm tra Authorized bucket ID (không có gs://), và quyền của service account trên Play Console (mục 1). Quyền mới cấp có thể cần tới 24 giờ. |
Found no associated apps with these credentials | Service account không thấy app nào: chưa được thêm trên Play Console, chưa đủ quyền, hoặc project chưa bật Google Play Developer Reporting API. |
| Ô Select reports trống | Elton không đọc được thư mục nào trong bucket: sai bucket, thiếu quyền, hoặc bucket chưa có báo cáo. |
| Lần chạy thành công nhưng không có bảng nào | Chỉ chọn thư mục báo cáo Elton không hỗ trợ. Xem danh sách ở mục 3. |
| Một số bảng không có dữ liệu | Bucket không có file của chiều đó cho app đã chọn, hoặc báo cáo nằm ở thư mục khác tên Elton đọc (xem ghi chú Subscriptions ở mục 4). |
| Lần chạy lỗi khi đọc file CSV | File trong bucket không đọc được (ví dụ không phải CSV UTF-16 như Google xuất). Kiểm tra file nêu trong log lỗi. |
| Partial reload không lấy đúng khoảng ngày đã chọn | Source này không lấy theo ngày; Partial reload chạy như lần chạy thường (đọc file của năm hiện tại). Muốn lấy lại các năm trước, dùng Full reload. |
| Dữ liệu của nhiều app nằm chung một bảng | Mọi app (và mọi connection không đặt Table name suffix) ghi vào cùng bảng. Lọc theo package_name. |
Cách tính Billable Pipeline
Cách tính phí theo số pipeline của từng loại source xem ở đây.