Closed MrOrz closed 1 year ago
Deployment: set these env vars
- TIMEZONE=Asia/Taipei
- LINE_BOT_EVENT_DATASET_ID=
- GA4_DATASET_ID=
- GA_WEB_STREAM_ID=
- GA_LIFF_STREAM_ID=
- GOOGLE_APPLICATION_CREDENTIALS=/data/...
Cronjob that updates "yesterday"'s stat (on staging)
15 16 * * * cd answerfamily-deploy; TZ='Asia/Taipei' YESTERDAY=`date --date='yesterday' +'%Y%m%d'` ./compose-all exec -T cofacts-api-staging node build/scripts/fetchStatsFromGA.js --startDate=$YESTERDAY --endDate=$YESTERDAY >> cron.log 2>&1
After updating from 6/5 to 6/26 + 6/27 (today)
This PR refactors
fetchStatsFromGA
script to read from BigQuery instead of deprecating Universal Analytics.Design doc: https://g0v.hackmd.io/cJFFXVzgT4OFT6bBLtulGg#-API
analytics
index's formanalytics
documents.docUserId
anddocAppId
fieldsanalytics
as expected