explain how to get Get Search volume and Competition value of keyword

602 views
Skip to first unread message

Hasitha Eranga

unread,
Jan 23, 2012, 6:11:58 AM1/23/12
to AdWords API Forum
can any one explain how to get Get Search volume and Competition value
of keyword in that kind of code segment in dimitriy's way in step by
step.
plz plz......

Evgeniy Bogdanov

unread,
Jan 23, 2012, 4:03:37 PM1/23/12
to AdWords API Forum
Hi.

Unfortuanelly you didn't pointed neither which programming laguage do
you use or what you mean by Dimitriy's way.

First of all you need to research documentation for
TargetingIdeaService which is located (http://code.google.com/intl/en/
apis/adwords/docs/reference/latest/TargetingIdeaService.html)
After that you can produce code on your desired programming language,
all official libraries have examples of basic usage for every service,
for TargetingIdeaService - too.

II'm edited basic example for PHP for you:

error_reporting(E_STRICT | E_ALL);

// You can set the include path to src directory or reference
// AdWordsUser.php directly via require_once.
// $path = '/path/to/aw_api_php_lib/src';
$path = dirname(__FILE__) . '/../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

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

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();

// Get the TargetingIdeaService.
$targetingIdeaService = $user->GetService('TargetingIdeaService',
'v201109');

// Create seed keyword.
$keyword = new Keyword();
$keyword->text = 'mars cruise';
$keyword->matchType = 'BROAD';

// Create selector.
$selector = new TargetingIdeaSelector();
$selector->requestType = 'STATS'; // If you want get related
keywords too, change this to IDEAS
$selector->ideaType = 'KEYWORD';
// Setting up which data you want to get for every keyword
$selector->requestedAttributeTypes =
array('CRITERION', 'AVERAGE_TARGETED_MONTHLY_SEARCHES',
'COMPETITION',
'GLOBAL_MONTHLY_SEARCHES');

// Set selector paging (required for targeting idea service).
$paging = new Paging();
$paging->startIndex = 0;
$paging->numberResults = 10;
$selector->paging = $paging;

// Create related to keyword search parameter.
$relatedToKeywordSearchParameter = new
RelatedToKeywordSearchParameter();
$relatedToKeywordSearchParameter->keywords = array($keyword);

// Create keyword match type search parameter to ensure unique
results.
$keywordMatchTypeSearchParameter = new
KeywordMatchTypeSearchParameter();
$keywordMatchTypeSearchParameter->keywordMatchTypes =
array('BROAD');

$selector->searchParameters =
array($relatedToKeywordSearchParameter,
$keywordMatchTypeSearchParameter);

// Get related keywords.
$page = $targetingIdeaService->get($selector);

// Display related keywords.
if (isset($page->entries)) {
foreach ($page->entries as $targetingIdea) {
$data = MapUtils::GetMap($targetingIdea->data);
$keyword = $data['CRITERION']->value;
$averageMonthlySearches =
isset($data['AVERAGE_TARGETED_MONTHLY_SEARCHES']->value)
? $data['AVERAGE_TARGETED_MONTHLY_SEARCHES']->value : 0;

$globalMonthlySearches =
isset($data['GLOBAL_MONTHLY_SEARCHES']->value)
? $data['GLOBAL_MONTHLY_SEARCHES']->value : 0;

$competition =
isset($data['COMPETITION']->value)
? $data['COMPETITION']->value : 0;

printf("Keyword with text '%s', match type '%s', global
monthly searches '%s', competition '%s' and average monthly "
. "search volume '%s' was found.\n", $keyword->text,
$keyword->matchType, $globalMonthlySearches, $competition,
$averageMonthlySearches);
}
} else {
print "No related keywords were found.\n";
}
} catch (Exception $e) {
print $e->getMessage();
}


Regards,
Evgeniy.

Hasitha Eranga

unread,
Jan 27, 2012, 4:55:54 AM1/27/12
to AdWords API Forum
Hi,

thanks for u r help sorry for my second post

Regards,

Hasitha

Reply all
Reply to author
Forward
0 new messages