Last week I had written a script to get Local and Global Search Volumes, CPC and Competition values using TargetingIdeaService. I'm using API v201302, and utilize NetworkSearchParameter to exclude "targetSearchNetwork", and LocationSearchParameter to find local values. Last week I seem to have had this working, the values being returned matched those in the Keyword Tool. However I noticed today the values were different, and I cannot find the reason for the discrepancy.
This is the relevant code I'm using to fetch Local SearchVol, CPC and Competition:
// Get the service, which loads the required classes.
$targetingIdeaService = $user->GetService('TargetingIdeaService', 'v201302');
$selector = new TargetingIdeaSelector();
$selector->requestType = 'STATS';
$selector->ideaType = 'KEYWORD';
$selector->requestedAttributeTypes = array('KEYWORD_TEXT', 'SEARCH_VOLUME', 'AVERAGE_CPC', 'COMPETITION');
// Create related to query search parameter, performs EXACT queries
$relatedToQuerySearchParameter = new RelatedToQuerySearchParameter();
$relatedToQuerySearchParameter->queries = array('network equipment','electricity','skiing');
$selector->searchParameters[] = $relatedToQuerySearchParameter;
// Exclude Search Partners from results
$networkSearchParameter = new NetworkSearchParameter();
$networkSetting = new networkSetting();
$networkSetting->targetGoogleSearch=true;
$networkSetting->targetSearchNetwork=false;
$networkSetting->targetContentNetwork=false;
$networkSetting->targetPartnerSearchNetwork=false;
$networkSearchParameter->networkSetting = $networkSetting;
$selector->searchParameters[] = $networkSearchParameter;
// Set location to US only
$locationTargetParameter = new LocationSearchParameter();
$unitedStates = new Location();
$unitedStates->id = 2840;
$locationTargetParameter->locations[] = $unitedStates;
$selector->searchParameters[] = $locationTargetParameter;
The values I see on the web interface when I search for the same keywords, as Exact, location set to US and all other filters off:
All the values I get from the API but Competition are wrong, however this exact script was reporting the same values less than a week ago. I've tried changing the NetworkSearchParameter settings and location settings and simply cannot find what is causing my values to differ from the web interface.
I'm at a loss to explain why this worked before and doesn't anymore. Can somebody explain what I may have done wrong, or why this isn't working anymore?