dev-master
9999999-devGet the top read articles of your page.
The Requires
by Ricardo Ruwer
read analytics articles top
Wallogit.com
2017 © Pedro Peláez
Get the top read articles of your page.
composer require "ruwer/toparticles":"dev-master"
Add to your config/app.php:, (*1)
'providers' => [
//...
Ruwer\TopArticles\TopArticlesServiceProvider::class,
],
and:, (*2)
'aliases' => [
//...
'TopArticles' => Ruwer\TopArticles\TopArticlesFacade::class,
],
In your terminal:, (*3)
php artisan vendor:publish --provider="Ruwer\TopArticles\TopArticlesServiceProvider"
composer dump-autoload
Now open the file: config/analytics.php and configure the path of your JSON file generated by Google Analytics., (*4)
In your controller:, (*5)
use TopArticles;
TopArticles::get(
"ga:xxxxxxxx", //Your Google Analytics Profile ID
"7daysAgo", //Begin Date
"today", //End date (you can also use Y-m-d)
"(articles/)", //Regex for Filters (everything containing "articles/")
10 //Results
);
//It'll return an array with your top viewed articles :)
Get the top read articles of your page.
read analytics articles top