2017 © Pedro Peláez
 

library toparticles

Get the top read articles of your page.

image

ruwer/toparticles

Get the top read articles of your page.

  • Friday, July 8, 2016
  • by ricardoruwer
  • Repository
  • 0 Watchers
  • 7 Stars
  • 1,993 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 31 % Grown

The README.md

TopArticles for Laravel 5

  • A Laravel 5 package used to list your top articles by date.
  • Uses Google Analytics API.

First of all

1.

  • Go to: https://console.developers.google.com/apis/credentials
  • Create credentials
  • Service account key
  • New service account
  • Put the name, select JSON and Create!

2.

  • Open the downloaded file.
  • Copy the e-mail at "client_email".
  • Go to: https://analytics.google.com
  • Admin
  • Select your account and go to User Management
  • Paste the e-mail on the input and Add!
  • Now copy the JSON file to your project.

Instalation

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)

How to use

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 :)

The Versions

08/07 2016

dev-master

9999999-dev

Get the top read articles of your page.

  Sources   Download

The Requires

 

by Ricardo Ruwer

read analytics articles top