I am going to make plugin, collecting post views from Google Analytics. The main idea is to get views per post and store them with post meta.
Problem:
My blog has a lot of posts and google analytics returns data very slow. It is about 30min for example to collect all data.
Possible solutions:
Use Linux crontab to execute /cron.php file from my plugin folder. This file should contains something like:
require_once('/../../../wp-blog-header.php');
Use
wp_schedule_event
function to execute heavy query using wordpress core.
How do you think, what method more preferred and what props and cons.