Hi,
I would like to know how to get video campaign statistics data through API.
We are using the below script with the ad performance report but can not receive data of video campaigns.
If you could help us, I would appreciate it.
<?php
require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
header('Content-type: text/plain; charset=utf-8');
class Mainapp{
public function googlelistacc($username,$password,$CustomerId)
{
$username=trim($username);
$password=trim($password);
$googleconfig = parse_ini_file(dirname(__FILE__) . '/../../../logs/configgoogleacc.ini', false);
if($password != $googleconfig['password'] || $username != $googleconfig['username']){
echo"Username OR Password Wrong !!!";
exit();
}
$developerToken = $googleconfig['developerToken'];
$user = new AdWordsUser(null, null, null, $developerToken);
$user->SetDefaultServer("https://adwords.google.com/");
$user->LogAll();
$user->SetClientId($googleconfig['ClientId']);
$user->SetClientCustomerId($CustomerId);
$managedCustomerService = $user->GetService('CampaignService', 'v201506');
$selector = new Selector();
$selector->fields = array('CampaignId', 'Name','Status');
$page = $managedCustomerService->get($selector);
$accounts = array();
foreach ($page->entries as $account) {
if ($account->id > 0) {
$accounts[] = $account;
}
}
$customer='';
foreach ($accounts as $account) {
$name=iconv('UTF-8','TIS-620',$account->name);
$customer.='|'.$account->id;
$customer.='|'.$account->name;
//$customer.='|'.$account->status;
}
if(file_exists('soap_xml.log'))
{
unlink('soap_xml.log');
}
if(file_exists('request_info.log'))
{
unlink('request_info.log');
}
return $customer;
}
}
$Login = new Mainapp();
$data=$Login->googlelistacc($_GET['username'],$_GET['password'],$_GET['customerid']);
print $data;
?>
No comments:
Post a Comment