Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/megaads-vn/ga-api-service
Service get report from google analytic and google ads
https://github.com/megaads-vn/ga-api-service
Last synced: 10 days ago
JSON representation
Service get report from google analytic and google ads
- Host: GitHub
- URL: https://github.com/megaads-vn/ga-api-service
- Owner: megaads-vn
- Created: 2020-02-25T09:22:48.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-27T09:46:27.000Z (almost 5 years ago)
- Last Synced: 2024-04-17T16:22:14.960Z (9 months ago)
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#Installation
add in file composer.json
```
"require": {
"megaads/ga-service": "^1.2"
}
```
#
#Get Report From Google Analytic
```
$KEY_FILE_LOCATION = '../config/client-secrets.json';
$name = 'Chiaki';
$filter = [
'viewId' => 'xxxxxxxx',
'from' => '2020-02-01',
'to' => '2020-02-25',
'metrics' => [
'ga:sessions', 'ga:users', 'ga:bounces'
]
];
$gaTransfer = new \GaServices\GoogleAnalytic();
$items = $gaTransfer->report($name, $KEY_FILE_LOCATION, $filter);
```#Google Ads
```
\\ Get cost ads of account
$adsCostAccount = new \GaServices\AdsCostAccount();
$fileConfig = '../config/adsapi_php.ini';
$customerId = 'xxx-xxx-xxxx';
$filter = ['from' => '2020-01-01', 'to' => '2020-01-29']
$cost = $adsCostAccount->report($customerId, $fileConfig, $filter);
```