вторник, 11 сентября 2018 г., 2:59:43 UTC+3 пользователь Евгений Морозов 
написал:
>
> I found an example 
> get-expanded-text-ads-in-an-ad-group.php 
> <https://developers.google.com/adwords/api/docs/samples/php/basic-operations#get-expanded-text-ads-in-an-ad-group>
>
> how to modify it to return a link to site page?
>
> example
>
>
> class GetExpandedTextAds
> {
>
>     const AD_GROUP_ID = 'INSERT_AD_GROUP_ID_HERE';
>     const PAGE_LIMIT = 500;
>
>     public static function runExample(
>         AdWordsServices $adWordsServices,
>         AdWordsSession $session,
>         $adGroupId
>     ) {
>         $adGroupAdService = $adWordsServices->get($session, 
> AdGroupAdService::class);
>
>         // Create a selector to select all ads for the specified ad group.
>         $selector = new Selector();
>         $selector->setFields(
>             ['Id', 'Status', 'HeadlinePart1', 'HeadlinePart2', 'Description']
>         );
>         $selector->setOrdering([new OrderBy('Id', SortOrder::ASCENDING)]);
>         $selector->setPredicates(
>             [
>                 new Predicate('AdGroupId', PredicateOperator::IN, 
> [$adGroupId]),
>                 new Predicate(
>                     'AdType',
>                     PredicateOperator::IN,
>                     [AdType::EXPANDED_TEXT_AD]
>                 ),
>                 new Predicate(
>                     'Status',
>                     PredicateOperator::IN,
>                     [AdGroupAdStatus::ENABLED, AdGroupAdStatus::PAUSED]
>                 )
>             ]
>         );
>         $selector->setPaging(new Paging(0, self::PAGE_LIMIT));
>
>         $totalNumEntries = 0;
>         do {
>             // Retrieve ad group ads one page at a time, continuing to 
> request pages
>             // until all ad group ads have been retrieved.
>             $page = $adGroupAdService->get($selector);
>
>             // Print out some information for each ad group ad.
>             if ($page->getEntries() !== null) {
>                 $totalNumEntries = $page->getTotalNumEntries();
>                 foreach ($page->getEntries() as $adGroupAd) {
>                     printf(
>                         "Expanded text ad with ID %d, status '%s', and 
> headline '%s - %s' was found.\n",
>                         $adGroupAd->getAd()->getId(),
>                         $adGroupAd->getStatus(),
>                         $adGroupAd->getAd()->getHeadlinePart1(),
>                         $adGroupAd->getAd()->getHeadlinePart2()
>                     );
>                 }
>             }
>
>             $selector->getPaging()->setStartIndex(
>                 $selector->getPaging()->getStartIndex() + self::PAGE_LIMIT
>             );
>         } while ($selector->getPaging()->getStartIndex() < $totalNumEntries);
>
>         printf("Number of results found: %d\n", $totalNumEntries);
>     }
>
>
>     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,
>             intval(self::AD_GROUP_ID)
>         );
>     }
> }
>
> GetExpandedTextAds::main();
>
>
> im add selectors
>

$selector->setFields(
            ['Id', 'Status', 'HeadlinePart1', 'HeadlinePart2', 
'Description', 'path1', 'path2', 'url', 'displayUrl', 'finalUrls', 
'finalMobileUrls', 'finalAppUrls', 'urlData']
); 

result: error

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 and Google Ads 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/82fd0601-3457-4f0a-864b-2761cc0ccd22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • ... Евгений Морозов
    • ... Евгений Морозов
      • ... 'Luis Xander Talag (AdWords API Team)' via AdWords API and Google Ads API Forum

Reply via email to