hi i have a awql qury that i have edit i need to get all the extensions
form adgroup level and get CallFeedItem
--- php -----
use Google\AdsApi\AdWords\AdWordsServices;
use Google\AdsApi\AdWords\AdWordsSession;
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
use Google\AdsApi\AdWords\v201702\cm\AdGroupExtensionSettingService;
use Google\AdsApi\Common\OAuth2TokenBuilder;
class GetCampaignsWithAwql {
const PAGE_LIMIT = 10;
public static function runExample(AdWordsServices $adWordsServices,
AdWordsSession $session) {
$campaignService = $adWordsServices->get($session,
AdGroupExtensionSettingService ::class);
$qury = $_GET["adgroup"];
// Create AWQL query.
$query = "SELECT AdGroupId, ExtensionType , Extensions WHERE AdGroupId
= '".$qury."' ";
// Create paging controls.
$totalNumEntries = 0;
$adgroups = array();
$offset = 0;
do {
$pageQuery = sprintf('%s LIMIT %d,%d', $query, $offset,
self::PAGE_LIMIT);
$page = $campaignService->query($pageQuery);
// Display results from the query.
if ($page->getEntries() !== null) {
$totalNumEntries = $page->getTotalNumEntries();
foreach ($page->getEntries() as $extension) {
$arr = array(
"adgroup_id" => $extension->getAdGroupId() ,
"extensions" => $extension->getExtensionSetting()->getExtensions(),
"type" => $extension->getExtensionType()
);
array_push($adgroups,$arr );
}
}
// Advance the paging offset.
$offset += self::PAGE_LIMIT;
} while ($offset < $totalNumEntries);
$array_data = json_encode($adgroups,true);
exit($array_data);
}
public static function main() {
// Generate a refreshable OAuth2 credential for authentication.
$oAuth2Credential = (new OAuth2TokenBuilder())
->fromFile()
->build();
// Construct an API session configured from a properties file and the
OAuth2
// credentials above.
$session = (new AdWordsSessionBuilder())
->fromFile()
->withOAuth2Credential($oAuth2Credential)
->build();
self::runExample(new AdWordsServices(), $session);
}
}
GetCampaignsWithAwql::main();
----- php / -----
when i run this i am getting this:
[{"adgroup_id":1900848642,"extensions":[{"ExtensionFeedItem.Type":"SitelinkFeedItem"},{"ExtensionFeedItem.Type":"SitelinkFeedItem"},{"ExtensionFeedItem.Type":"SitelinkFeedItem"},{"ExtensionFeedItem.Type":"SitelinkFeedItem"}],"type":"SITELINK"},{"adgroup_id":1900848642,"extensions":[{"ExtensionFeedItem.Type":"CallFeedItem"}],"type":"CALL"}]
i need to get from sitelinks:
-sitelinkText
-sitelinkUrl
and from CALL
-callPhoneNumber
-callTracking
can someone help my?
thanks
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/240ba2e0-7557-4dc7-8fbb-508b5fa69616%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.