PHPackages                             shahariaazam/google-analytics-api-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. shahariaazam/google-analytics-api-php

ActiveProject[API Development](/categories/api)

shahariaazam/google-analytics-api-php
=====================================

Simple Google Analytics Reporting API

58.2k1PHP

Since Jun 14Pushed 12y agoCompare

[ Source](https://github.com/shahariaazam/Google-Analytics-API-PHP)[ Packagist](https://packagist.org/packages/shahariaazam/google-analytics-api-php)[ RSS](/packages/shahariaazam-google-analytics-api-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

\#Google Analytics API PHP

Clone this repo and run [composer](http://getcomposer.com). `composer install` then it will autoload the classes and you are done!

Simple class to set up Oauth 2.0 with Google and query the Google Analytics API v3 with PHP. Curl is required! The class supports getting the access tokens for *web applications* and *service accounts* registered in the Google APIs console.
See the documentation for further informations:

\##Install via Composer Just add the following line in your `composer.json` and update your dependencies via running composer update command. `"shahariaazam/google-analytics-api-php": "dev-master"`

\##1. Basic Setup

- Create a Project in the Google APIs Console:
- Enable the Analytics API under Services
- Under API Access: Create an Oauth 2.0 Client-ID
- Give a Product-Name, choose *Web Application* or *Service Account* depending on your needs
- Web Application: Set a redirect-uri in the project which points to your apps url
- Service Account: Download the private key (.p12 file)

\##2. Set up Auth

Depending on the chosen application type, the setup is slightly different. This section describes both ways independently.

\###Web applications

```
