Warning: this plugin is under active development. Updating to new versions might require reactivating to rebuild database tables, as there is currently no upgrading framework.
The problem we found with many WordPress popular post plugins was the lack of data used in the algorithm. Our approach was first to pull as much data as possible into WordPress so we could develop a better algorithm.
We're currently calling and caching the ga:pageviews
to the database for each ga:pagepath
dimension. Values for the current day and previous are stored during each cron job. A post id is generated for each ga:pagepath
that corresponds to an actual post.
The data is stored across two database tables. The first (analyticbridge_pages
) stores each ga:pagepath
with a unique id and corresponding post id (if it exists).
The second table (analyticbridge_metrics
) relates a page_id
to a metric & value over a start & end date.
To query this data yourself, find the corresponding page_id from the pages table and select using it from the metrics table. This can be accomplished using joins.