I am the first time to use Google API in keyword search.
The problem is 'the locale monthly searches' value I got form google
backstage is different with the data I got through Google keywords API
on keyword like "mba辅导", I urgently want to know how did this happen.

       the keyword 'mba辅导' values on  'the locale monthly searches'  I
got through google backstage as follow:
-------------------------------------------------------------------------------------------------------------------------------------------------
data source     ---------   keyword  ---  local avg monthly searches
(broad) --- local avg monthly searches  (phrase)  ----  local avg
monthly searches  (exact)  ---  country ---- language

google backstage      mba辅导   6600                 4400
1300           china         simple-chinese

google API               mba辅导   14800
***                 ***            china          simple-chinese

---------------------------------------------------------------------------------------------------------------------------------------------------------
       the code as follow:
---------------------------------------------------------------------------------------------------------------------------------------------------------
// Copyright 2010, Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package v201003;

import java.util.Map;

import com.google.api.adwords.lib.AdWordsService;
import com.google.api.adwords.lib.AdWordsServiceLogger;
import com.google.api.adwords.lib.AdWordsUser;
import com.google.api.adwords.lib.utils.MapUtils;
import com.google.api.adwords.v201003.cm.CountryTarget;
import com.google.api.adwords.v201003.cm.Keyword;
import com.google.api.adwords.v201003.cm.KeywordMatchType;
import com.google.api.adwords.v201003.cm.LanguageTarget;
import com.google.api.adwords.v201003.cm.Paging;
import com.google.api.adwords.v201003.o.Attribute;
import com.google.api.adwords.v201003.o.AttributeType;
import
com.google.api.adwords.v201003.o.AverageTargetedMonthlySearchesSearchParameter;
import com.google.api.adwords.v201003.o.CountryTargetSearchParameter;
import com.google.api.adwords.v201003.o.DoubleAttribute;
import com.google.api.adwords.v201003.o.IdeaType;
import com.google.api.adwords.v201003.o.KeywordAttribute;
import
com.google.api.adwords.v201003.o.KeywordMatchTypeSearchParameter;
import com.google.api.adwords.v201003.o.LanguageTargetSearchParameter;
import com.google.api.adwords.v201003.o.LongAttribute;
import com.google.api.adwords.v201003.o.MonthlySearchVolume;
import com.google.api.adwords.v201003.o.MonthlySearchVolumeAttribute;
import
com.google.api.adwords.v201003.o.RelatedToKeywordSearchParameter;
import com.google.api.adwords.v201003.o.RequestType;
import com.google.api.adwords.v201003.o.SearchParameter;
import com.google.api.adwords.v201003.o.TargetingIdea;
import com.google.api.adwords.v201003.o.TargetingIdeaPage;
import com.google.api.adwords.v201003.o.TargetingIdeaSelector;
import com.google.api.adwords.v201003.o.TargetingIdeaServiceInterface;

/**
 * This example gets keywords related to a seed keyword.
 *
 * Tags: TargetingIdeaService.get
 *
 * @author api.aro...@gmail.com (Adam Rogal)
 */
public class GetRelatedKeywords {
  public static void main(String[] args) throws Exception {
    // Log SOAP XML request and response.
    AdWordsServiceLogger.log();

    // Get AdWordsUser from "~/adwords.properties".
    AdWordsUser user = new AdWordsUser();

    // Get the TargetingIdeaService.
    TargetingIdeaServiceInterface targetingIdeaService
=user.getService(AdWordsService.V201003.TARGETING_IDEA_SERVICE);

    // Create seed keyword.
    Keyword keyword = new Keyword();
    keyword.setText("mba辅导");
    keyword.setMatchType(KeywordMatchType.BROAD);
    // Create selector.
    TargetingIdeaSelector selector = new TargetingIdeaSelector();
    selector.setRequestType(RequestType.IDEAS);//RequestType.STATS 不联想
    selector.setIdeaType(IdeaType.KEYWORD);
    selector.setRequestedAttributeTypes(new AttributeType[] {
                AttributeType.KEYWORD,
                AttributeType.AVERAGE_TARGETED_MONTHLY_SEARCHES,
                AttributeType.GLOBAL_MONTHLY_SEARCHES,
                AttributeType.TARGETED_MONTHLY_SEARCHES,
                AttributeType.COMPETITION
                });

    // Set selector paging (required for targeting idea serivce).
    Paging paging = new Paging();
    paging.setStartIndex(0);
    paging.setNumberResults(10);
    selector.setPaging(paging);

    // Create related to keyword search parameter.
    RelatedToKeywordSearchParameter relatedToKeywordSearchParameter =
new RelatedToKeywordSearchParameter();
    relatedToKeywordSearchParameter.setKeywords(new Keyword[]
{keyword});

    //country
        CountryTarget c = new CountryTarget();
        c.setCountryCode("CN");
        c.getExcluded();
        CountryTargetSearchParameter countryTargetSearchParameter = new
CountryTargetSearchParameter();
        countryTargetSearchParameter.setCountryTargets(new CountryTarget[]
{c});

        //language
        LanguageTarget l1 = new LanguageTarget();
    l1.setLanguageCode("zh_CN");
    LanguageTargetSearchParameter langTargetSearchParameter = new
LanguageTargetSearchParameter();
    langTargetSearchParameter.setLanguageTargets(new LanguageTarget[]
{l1});

    // Create keyword match type search parameter to ensure unique
results.
    KeywordMatchTypeSearchParameter keywordMatchTypeSearchParameter =
        new KeywordMatchTypeSearchParameter();
    keywordMatchTypeSearchParameter.setKeywordMatchTypes(
        new KeywordMatchType[] {KeywordMatchType.BROAD});


        selector.setSearchParameters(new SearchParameter[] {
                        relatedToKeywordSearchParameter
                        ,countryTargetSearchParameter
                        ,langTargetSearchParameter
                        ,keywordMatchTypeSearchParameter
        });

    //selector.setSearchParameters(new SearchParameter[]
{relatedToKeywordSearchParameter,keywordMatchTypeSearchParameter,});

    // Get related keywords.
    TargetingIdeaPage page = targetingIdeaService.get(selector);

    // Display related keywords.
    if (page.getEntries() != null && page.getEntries().length > 0) {
      for (TargetingIdea targetingIdea : page.getEntries()) {
        Map<AttributeType, Attribute> data =
MapUtils.toMap(targetingIdea.getData());
        keyword = ((KeywordAttribute)
data.get(AttributeType.KEYWORD)).getValue();
        DoubleAttribute compition =
((DoubleAttribute)data.get(AttributeType.COMPETITION));
        Long averageMonthlySearches =  ((LongAttribute)
data.get(AttributeType.AVERAGE_TARGETED_MONTHLY_SEARCHES)).getValue();
        Long grobalMonthlySearches =  ((LongAttribute)
data.get(AttributeType.GLOBAL_MONTHLY_SEARCHES)).getValue();
        MonthlySearchVolume[] targetMonthlySearches =
((MonthlySearchVolumeAttribute)data.get(AttributeType.TARGETED_MONTHLY_SEARCHES)).getValue();

        //Placement placement =
((PlacementAttribute)data.get(AttributeType.PLACEMENT)).getValue();
        //String adShare = ((StringAttribute)
data.get(AttributeType.AD_SHARE)).getValue();

        System.out.println("Keyword with text '" + keyword.getText() +
"', match type '"
            + keyword.getMatchType() + "',"
            +" AVERAGE_TARGETED_MONTHLY_SEARCHES【本地平均月搜索量】 = " +
(averageMonthlySearches==null?"":averageMonthlySearches.doubleValue())
            );
      }
    } else {
       System.out.println("No related keywords were found.");
    }
  }
}

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to