Search in sources :

Example 1 with CampaignGroupOperation

use of com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupOperation in project googleads-java-lib by googleads.

the class AddCampaignGroupsAndPerformanceTargets method createCampaignGroup.

/**
 * Creates a campaign group.
 */
private static CampaignGroup createCampaignGroup(AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
    // Get the CampaignGroupService.
    CampaignGroupServiceInterface campaignGroupService = adWordsServices.get(session, CampaignGroupServiceInterface.class);
    // Create the campaign group.
    CampaignGroup campaignGroup = new CampaignGroup();
    campaignGroup.setName("Mars campaign group #" + System.currentTimeMillis());
    // Create the operation.
    CampaignGroupOperation operation = new CampaignGroupOperation();
    operation.setOperand(campaignGroup);
    operation.setOperator(Operator.ADD);
    CampaignGroup newCampaignGroup = campaignGroupService.mutate(new CampaignGroupOperation[] { operation }).getValue(0);
    System.out.printf("Campaign group with ID %d and name '%s' was created.%n", newCampaignGroup.getId(), newCampaignGroup.getName());
    return newCampaignGroup;
}
Also used : CampaignGroupOperation(com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupOperation) CampaignGroup(com.google.api.ads.adwords.axis.v201809.cm.CampaignGroup) CampaignGroupServiceInterface(com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupServiceInterface)

Aggregations

CampaignGroup (com.google.api.ads.adwords.axis.v201809.cm.CampaignGroup)1 CampaignGroupOperation (com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupOperation)1 CampaignGroupServiceInterface (com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupServiceInterface)1