V220909- Category codes

23 views
Skip to first unread message

Shiv Bhaduri

unread,
Nov 10, 2009, 9:28:50 AM11/10/09
to AdWords API Forum
Hi,

Where can we get the Keyword category codes with category name mapping
for V2009 version ?

Also, why do many keywords with obvious categories do not return and
category codes ? The % is very large and beats the purpose of having
the functionality.

Thanks...Shiv

AdWords API Advisor

unread,
Nov 10, 2009, 4:52:43 PM11/10/09
to AdWords API Forum
Hi Shiv,

Can you give me an example of how you are using these categories? I'm
not sure I understand what categories you are referring to.

Best,
- Eric Koleda, AdWords API Team

Shiv Bhaduri

unread,
Nov 11, 2009, 7:06:08 AM11/11/09
to AdWords API Forum
Hi Eric,

Here is code I'm using, its very basic.

####################Code######################
<?php

error_reporting(E_STRICT | E_ALL);
date_default_timezone_set("Europe/Brussels");


$path = dirname(__FILE__) . '/../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';


class GetAllKeywordsExample {
static function main($keywords_input, $match_type) {
$return_array = array();
try {
// Get AdWordsUser from credentials in "../auth.ini"
// relative to the AdWordsUser.php file's directory.
$user = new AdWordsUser();

// Log SOAP XML request and response.
$user->LogDefaults();

$keywordService = $user->GetTargetingIdeaService();

$keyword = new Keyword();
$keyword->text = $keywords_input;
$keyword->matchType = $match_type;

$languageService= new LanguageTarget();
$languageService->languageCode='en';
$languageService->TargetType='en';

$countryService= new CountryTargetSearchParameter();
$countryService->countryTargets='UK';


$keyword_array = array($keyword);
$relatedToKeywordSearchParameter = new
RelatedToKeywordSearchParameter($keyword_array, $languageService,
$countryService);


$targetingIdeaSelector = new TargetingIdeaSelector();
$targetingIdeaSelector->searchParameters = array(
$relatedToKeywordSearchParameter
);

$targetingIdeaSelector->ideaType = 'KEYWORD';
$targetingIdeaSelector->requestType = 'IDEAS';


$targetingIdeaSelector->requestedAttributeTypes=array
( 'KEYWORD','GLOBAL_MONTHLY_SEARCHES',
'KEYWORD_CATEGORY','COMPETITION' );
$targetingIdeaSelector->paging = new Paging(0,400);


$keywordPage = $keywordService->get($targetingIdeaSelector);

$return_array=array();

if(isset($keywordPage->entries)) {
foreach ($keywordPage->entries as $keyword_entry) {
foreach($keyword_entry as $keyword_entry_array){
foreach ($keyword_entry_array as $keyword){
if($keyword->key == 'KEYWORD'){
$keyword_value = $keyword->value;
$kwtext=$keyword_value->value->text;
}
if($keyword->key == 'GLOBAL_MONTHLY_SEARCHES'){
$keyword_value = $keyword->value;
$gms=$keyword_value->value;
}
if($keyword->key == 'KEYWORD_CATEGORY'){
$keyword_value = $keyword->value;
$kwcat=$b = implode (',', $keyword_value->value);
}

$return_array[] = array( $kwtext, $gms, $kwcat);
}
}
}
} else {
throw new Exception("No keyword found",0);
}
} catch (Exception $e) {

$return_array[] = array(
'keyword'=>$e->getMessage());

}
return $return_array;
}
}

$result = GetAllKeywordsExample::main("computer", 'BROAD');
var_dump($result);

?>

##################Output###############

I get an array with with three elemnts.

Keyword, Monthly Searches and Keyword Category code.

However, Keyword category is mostly null for many ovbious terms (You
can try with terms like computer, kfc etc.). Also, where do we get
the category name and code mapping table to map the category id to a
category name.

Hope this helps.

Thanks...........Shiv

On Nov 10, 9:52 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:

Shiv Bhaduri

unread,
Nov 12, 2009, 6:26:58 PM11/12/09
to AdWords API Forum
Hi,

Could anyone please help ? Why dont we have this basic info... its the
code list just like V13 ?

Shiv

AdWords API Advisor

unread,
Nov 16, 2009, 10:03:36 AM11/16/09
to AdWords API Forum
Hi Shiv,

I've been working with some members of the AdWords API Team on
publishing the list of category names. I don't have an exact timeline
of when they will be made available, but I'll update this thread when
they are.

Best,
- Eric

kolok

unread,
Jan 14, 2010, 7:08:48 AM1/14/10
to AdWords API Forum
Hi Eric

I have the same request. I use TargetingIdeaServices and I want to
know placement category of each site but I receive only categoryId. do
you know went the list of category names will be publish and if a
service request will be provide to get all the list.

Thank for your answer.
Nicolas

On Nov 16 2009, 4:03 pm, AdWords API Advisor

AdWords API Advisor

unread,
Jan 15, 2010, 10:10:02 AM1/15/10
to AdWords API Forum
Hi Nicolas,

The current plan is to expose the list of categories in the AdWords
API documentation, but I don't have a timeline of when that would be
available.

Best,
- Eric

Reply all
Reply to author
Forward
0 new messages