cofacts / rumors-api

GraphQL API server for clients like rumors-site and rumors-line-bot
https://api.cofacts.tw
MIT License
110 stars 26 forks source link

script to fetch google analytics stats #188

Closed ztsai closed 4 years ago

ztsai commented 4 years ago

There's an edge case when the cron job runs at midnight, the first cron job of the day should also update the value for yesterday ie. if the last cron job of the day runs at 23:00, and the next one runs at 0:00, any activities between the last cron job till midnight won't be accounted for. I'm not sure if this should be handled by the script itself (i.e. check if current time is near midnight), or just set another cron job to run it once a day. The former is kinda weird and needs to watch out for the timezone setting of the server and GA. The later has a catch, that is, to run the script for any dates other than today would be ran in migration setting, which would use url path to determine doc id instead of content grouping. It shouldn't be that big of a deal since there aren't that many entries per day...

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.7%) to 87.556% when pulling b2780b090c9d688972a72fd72245f2fc1c2ffc46 on fetchGA into 236152b3af550ddebce0b110e3458bf3941c84dc on master.

ztsai commented 4 years ago

Thanks! I'll add that in a separate PR as discussed offline