PHP code example of edujugon / laravel-google-ads

1. Go to this page and download the library: Download edujugon/laravel-google-ads library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

edujugon / laravel-google-ads example snippets


'providers' => array(
        ...
        Edujugon\GoogleAds\Providers\GoogleAdsServiceProvider::class
    )

'aliases' => array(
        ...
        'GoogleAds' => Edujugon\GoogleAds\Facades\GoogleAds::class,
    )

php artisan vendor:publish --provider="Edujugon\GoogleAds\Providers\GoogleAdsServiceProvider" --tag="config"

php artisan googleads:token:generate

$campaignService = $ads->service(CampaignService::class);

$results = $campaignService->select('CampaignId','CampaignName')->get();

//You can also add any where condition on the list.
$campaign = $results->where('id',1341312);


$campaign = $results->where('id',$this->testedCampaignId)->set('name','hello !!');


$report = google_report();

$string = $ads->report()
            ->format('CSVFOREXCEL')
            ->select('CampaignId','AdGroupId','AdGroupName','Id', 'Criteria', 'CriteriaType','Impressions', 'Clicks', 'Cost', 'UrlCustomParameters')
            ->from('CRITERIA_PERFORMANCE_REPORT')
            ->getAsString();

$fields = $ads->report()->from('CRITERIA_PERFORMANCE_REPORT')->getFields();