how to use adwords api to grab all keywords?
-
09-02-2021 - |
문제
i set up an Google ad-words api and seems to work fine.
I can get GetAllCampaigns
, GetAllAdGroupCriteria
and GetAllAdGroups
.
but i want to get all keywords from a specific group/campaign, and the related data like: clicks, spent money.
i found this code online but im not sure how to use it:
$report = getKeywordXmlReport(
'Report Name', // String name
'2009-04-01', // String startDay
'2009-04-30', // String endDay
array('Campaign', 'AdGroup', 'Keyword', 'Impressions', 'Clicks',
'CTR', 'CPC', 'AveragePosition'), // [String] selectedColumns
array('Monthly'), // [String] aggregationTypes
array('54105960'), // [Integer] campaigns
array(), // [String] campaignStatuses
array(), // [Integer] adGroups
array(), // [String] adGroupStatuses
array(), // [String] keywords
array(), // [String] keywordStatuses
'SearchOnly', // String adWordsType
'Broad', // String keywordType
false, // Boolean isCrossClient
array(), // [String] clientEmails
false, // Boolean includeZeroImpression
30, // Integer sleepTime
false, // Boolean validateFirst
false // Boolean onlyReturnDownloadUrl
);
i need to know what class to load and what function to use.
Any ideas?
Thanks
해결책
Have you tried Google's PHP Adwords client library? It's at http://code.google.com/p/google-api-adwords-php/ and is full of examples.
If you're looking for keyword ("adgroup criteria," in their lingo) performance numbers then you need to create a report with the fields you want, add it, then download it after its complete. It's somewhat involved.
I suggest you check out http://www.google.com/codesearch#Fu0vUbQ37f4/trunk/src/Google/Api/Ads/AdWords/Util/TestUtils.php for their example code for running reports.