0
votes

I found this script at Google AdWords Script API. https://developers.google.com/adwords/api/docs/guides/adgroup-bid-modifiers But I get error at line 2: "Missing ; before statement (line 3)". I can't seem to find the problem.

// Get the AdGroupBidModifierService.
AdGroupBidModifierServiceInterface bidModifierService = adWordsServices.get(session, AdGroupBidModifierServiceInterface.class);

// Create selector.
Selector selector = new Selector();
selector.setFields(
    new String[] {"CampaignId", "AdGroupId", "Id", "BidModifier"});
selector.setPaging(new Paging(0, 10));

// Make a 'get' request.
AdGroupBidModifierPage page = bidModifierService.get(selector);

// Display bid modifiers.
if (page.getEntries() != null) {
  for (AdGroupBidModifier modifier : page.getEntries()) {
    String value = (modifier.getBidModifier() == null) ?
        "unset" : String.valueOf(modifier.getBidModifier())
    System.out.println("Campaign ID " + modifier.getCampaignId()
        + ", AdGroup ID " + modifier.getAdGroupId()
        + ", Criterion ID " + modifier.getCriterion().getId()
        + " has ad group level modifier: " + value);
  }
} else {
  System.out.println("No bid modifiers were found.");
}

Anyone else experienced problem with this code? Also is it possible to get it to work with AdWords.App?

2

2 Answers

0
votes

First: You can not use Java code in AdWords Scripts, you must use javascript. See more about Adwords Scripts in: https://developers.google.com/adwords/scripts/

Second: You can not get the CPC for old dates, just the current CPC bid

0
votes

Are you doing this as part of a Java application, or within the Google AdWords script editor?

If the latter, that's the problem. The Google Script editor works off Google Script (which is essentially JavaScript)