Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitLab with WP-CLI:
wp plugin install https://gitlab.com/drzraf/ga-popular/-/archive/master/ga-popular-master.zipOn Packagist as drzraf/ga-popular:
composer require drzraf/ga-popularNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
Google Analytics popular posts.
Collect statistics from a given Google Analytics view.
This plugin wraps a WordPress wp-cli command and is intended to be run from the command-line or from a regularly called cron script.
It uses the Google Analytics API (and relies upon a credential file) to collect the statistics from a specific Google Analytics view.
Viewing, filtering, sorting, ordering and limits, ... can be provided from command-line or from a JSON configuration file.
Output can be customized from a plain list of URL or a more extended JSON format containing desired metrics (pageViews, users, ...)
The command optionally allow to:
- determinate post ID corresponding to URL (In some WordPress usages)
- store the results as a WordPress option.
Benefits
- A self-contained and simple plugin providing other themes/plugins Google Analytics data they can directly consume using getoption().
- Protected Google Analytics credentials (Could be owned by root and piped to command's stdin. WordPress bootstrap is optional)
- A flexible way to customize statistics: A theme could write a valid JSON configuration file to be used.
Examples
- $ symfony-cli.php -c my-project-abcd.json -m ga: