// Get v13 traffic estimator service.
TrafficEstimatorInterface trafficEstimatorService =
user.getService(AdWordsService.V13.TRAFFIC_ESTIMATOR_SERVICE);
// Get v200909 AdGroupCriterionService.
AdGroupCriterionServiceInterface adGroupCriterionService =
user.getService(AdWordsService.V200909.ADGROUP_CRITERION_SERVICE);
Long adGroupId = Long.parseLong("INSERT_AD_GROUP_ID_HERE");
// Create selector to get all criteria under ad group.
AdGroupCriterionSelector selector = new AdGroupCriterionSelector();
selector.setIdFilters(new AdGroupCriterionIdFilter[] {
new AdGroupCriterionIdFilter(null, adGroupId, null)});
Map<Keyword, KeywordTraffic> keywordTrafficMap = new HashMap<Keyword, KeywordTraffic>();
// Get all keywords for ad group.
AdGroupCriterionPage page = adGroupCriterionService.get(selector);
if (page.getEntries() != null) {
for (AdGroupCriterion adGroupCriterion : page.getEntries()) {
if (adGroupCriterion.getCriterion() instanceof Keyword) {
keywordTrafficMap.put((Keyword) adGroupCriterion.getCriterion(), null);