Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jjcosgrove/php-gaoauth2
A simple PHP OAuth2 helper class for use with the Google Analytics API
https://github.com/jjcosgrove/php-gaoauth2
authentication google oauth2 php
Last synced: 4 days ago
JSON representation
A simple PHP OAuth2 helper class for use with the Google Analytics API
- Host: GitHub
- URL: https://github.com/jjcosgrove/php-gaoauth2
- Owner: jjcosgrove
- Created: 2015-05-07T11:22:11.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-07-23T10:03:54.000Z (6 months ago)
- Last Synced: 2024-12-06T22:18:16.117Z (about 1 month ago)
- Topics: authentication, google, oauth2, php
- Language: PHP
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gaOAuth2
gaOAuth2 is a simple helper class for working with the Google Analytics API.
Release information:
* Current Version: 1.0.0## Setup
* Place the files within your desired webroot.
* Configure the gaOAuth2 object via constructor (see Google GA API docs for help).
* Ensure permissions are correct for read/write by your server (for storing credentials).
* Visit the page - if it is your first run then you will be prompted to authenticate.
* Once authenticated, your GA API credentials will be stored for future use and refreshed when needed.## Usage
```php
require('gaOAuth2/gaOAuth2.php');$myGAOAuth2Config = array(
'gaClientId' => 'YOUR_CLIENT_ID_GOES_HERE',
'gaClientSecret' => 'YOUR_CLIENT_SECRET_GOES_HERE',
'gaRedirectURI' => 'YOUR_DOMAIN_GOES_HERE',
'gaOAuth2CredentialsJSON' => 'YOUR_CREDENTIALS_FILENAME_GOES_HERE'
);$myGAOAuth2 = new gaOAuth2($myGAOAuth2Config);
$myGAOAuth2->Authorize();$myGAQuery = '?ids=ga:123456789';
$myGAQuery .= '&metrics=ga:pageviews,ga:uniquePageviews,ga:avgTimeOnPage';
$myGAQuery .= '&filters=ga:country==United Kingdom';
$myGAQuery .= '&start-date=2015-04-01';
$myGAQuery .= '&end-date=2015-05-07';
$myGAQuery .= '&max-results=50';$myGAOAuth2Response = $myGAOAuth2->Request($myGAQuery);
```The included 'index.php' file provides a rough framework/example to get you started.
## Contact
Please send feedback, comments and suggestions to my email address which can be found within the gaOAuth2 class definition.
Bugs or feature requests/contributions can be done via:
[https://github.com/jjcosgrove/gaOAuth2/issues](https://github.com/jjcosgrove/gaOAuth2/issues)
## Authors
* Just me for now.