Package com.google.api.ads.dfa.axis.v1_19

Examples of com.google.api.ads.dfa.axis.v1_19.Placement


  private static final String PLACEMENT_ID = "INSERT_PLACEMENT_ID_HERE";

  public static void runExample(DfaServices dfaServices, DfaSession session, String adName,
      long campaignId, long sizeId, long creativeId, long placementId) throws Exception {
    // Request the service.
    AdRemote service = dfaServices.get(session, AdRemote.class);

    // Create a rotation group.
    RotationGroup rotationGroup = new RotationGroup();
    rotationGroup.setId(0);
    rotationGroup.setName(adName);
    rotationGroup.setActive(true);
    rotationGroup.setArchived(false);
    rotationGroup.setCampaignId(campaignId);
    rotationGroup.setSizeId(sizeId);
    rotationGroup.setTypeId(1);
    rotationGroup.setPriority(12);
    rotationGroup.setRatio(1);

    // Set the ad start date. This example uses tomorrow's date.
    Calendar startTime = Calendar.getInstance();
    startTime.add(Calendar.DATE, 1);
    rotationGroup.setStartTime(startTime);

    // Set the ad end date. This example uses one month from today's date.
    Calendar endTime = Calendar.getInstance();
    endTime.add(Calendar.MONTH, 1);
    rotationGroup.setEndTime(endTime);

    // Add creatives to the ad.
    CreativeAssignment creativeAssignment = new CreativeAssignment();
    creativeAssignment.setActive(true);
    creativeAssignment.setCreativeId(creativeId);

    // Create the click through URL.
    ClickThroughUrl clickThroughUrl = new ClickThroughUrl();
    clickThroughUrl.setDefaultLandingPageUsed(true);
    clickThroughUrl.setLandingPageId(0);
    creativeAssignment.setClickThroughUrl(clickThroughUrl);

    // Create the creative assignments.
    CreativeAssignment[] creativeAssignments = new CreativeAssignment[]{creativeAssignment};
    rotationGroup.setCreativeAssignments(creativeAssignments);
    rotationGroup.setRotationType(1);

    // Assign an ad to the placement.
    PlacementAssignment placementAssignment = new PlacementAssignment();
    placementAssignment.setActive(true);
    placementAssignment.setPlacementId(placementId);
    PlacementAssignment[] placementAssignments = new PlacementAssignment[]{placementAssignment};
    rotationGroup.setPlacementAssignments(placementAssignments);

    // Save the rotation group.
    AdSaveResult adSaveResult = service.saveAd(rotationGroup);

    // Display the new ad ID.
    System.out.printf("Ad with ID \"%s\" was created.%n", adSaveResult.getId());
  }
View Full Code Here


    placementAssignment.setPlacementId(placementId);
    PlacementAssignment[] placementAssignments = new PlacementAssignment[]{placementAssignment};
    rotationGroup.setPlacementAssignments(placementAssignments);

    // Save the rotation group.
    AdSaveResult adSaveResult = service.saveAd(rotationGroup);

    // Display the new ad ID.
    System.out.printf("Ad with ID \"%s\" was created.%n", adSaveResult.getId());
  }
View Full Code Here

      throws Exception {
    // Request the advertiser service from the service client factory.
    AdvertiserRemote advertiserService = dfaServices.get(session, AdvertiserRemote.class);

    // Create the advertiser structure.
    Advertiser advertiser = new Advertiser();
    advertiser.setId(0);
    advertiser.setName(advertiserName);
    advertiser.setAdvertiserGroupId(0);
    advertiser.setApproved(true);

    // Create the advertiser.
    AdvertiserSaveResult advertiserSaveResult = advertiserService.saveAdvertiser(advertiser);

    // Display the advertiser ID.
View Full Code Here

  private static final String ADVERTISER_NAME = "INSERT_ADVERTISER_NAME_HERE";

  public static void runExample(DfaServices dfaServices, DfaSession session, String advertiserName)
      throws Exception {
    // Request the advertiser service from the service client factory.
    AdvertiserRemote advertiserService = dfaServices.get(session, AdvertiserRemote.class);

    // Create the advertiser structure.
    Advertiser advertiser = new Advertiser();
    advertiser.setId(0);
    advertiser.setName(advertiserName);
    advertiser.setAdvertiserGroupId(0);
    advertiser.setApproved(true);

    // Create the advertiser.
    AdvertiserSaveResult advertiserSaveResult = advertiserService.saveAdvertiser(advertiser);

    // Display the advertiser ID.
    System.out.printf("Advertiser with ID \"%s\" was created.%n", advertiserSaveResult.getId());
  }
View Full Code Here

    advertiser.setName(advertiserName);
    advertiser.setAdvertiserGroupId(0);
    advertiser.setApproved(true);

    // Create the advertiser.
    AdvertiserSaveResult advertiserSaveResult = advertiserService.saveAdvertiser(advertiser);

    // Display the advertiser ID.
    System.out.printf("Advertiser with ID \"%s\" was created.%n", advertiserSaveResult.getId());
  }
View Full Code Here

      DfaServices dfaServices, DfaSession session, long advertiserId) throws Exception {
    // Request the service.
    ChangeLogRemote service = dfaServices.get(session, ChangeLogRemote.class);

    // Create change log search criteria structure.
    ChangeLogRecordSearchCriteria searchCriteria = new ChangeLogRecordSearchCriteria();
    searchCriteria.setPageSize(10);
    searchCriteria.setObjectId(advertiserId);
    // The following field has been filled in to choose advertiser change
    // logs. This values was determined using GetChangeLogObjectTypes.java.
    searchCriteria.setObjectTypeId(1L);

    // Get change log record set.
    ChangeLogRecordSet changeLogRecordSet = service.getChangeLogRecords(searchCriteria);

    // Set up a formatter to make the change log timestamps human-readable.
View Full Code Here

    // The following field has been filled in to choose advertiser change
    // logs. This values was determined using GetChangeLogObjectTypes.java.
    searchCriteria.setObjectTypeId(1L);

    // Get change log record set.
    ChangeLogRecordSet changeLogRecordSet = service.getChangeLogRecords(searchCriteria);

    // Set up a formatter to make the change log timestamps human-readable.
    SimpleDateFormat dateFormat = new SimpleDateFormat("d MMM yyyy HH:mm");

    // Display the contents of each change log record
    if (changeLogRecordSet.getRecords() != null) {
      for (ChangeLogRecord result : changeLogRecordSet.getRecords()) {
        System.out.println("Action \"" + result.getAction()
            + "\", Context \"" +  result.getContext()
            + "\", Change Date \"" + dateFormat.format(result.getChangeDate().getTime())
            + "\", New Value \"" + result.getNewValue()
            + "\", Old Value \"" + result.getOldValue()
View Full Code Here

  private static final String ADVERTISER_ID = "INSERT_ADVERTISER_ID_HERE";

  public static void runExample(
      DfaServices dfaServices, DfaSession session, long advertiserId) throws Exception {
    // Request the service.
    ChangeLogRemote service = dfaServices.get(session, ChangeLogRemote.class);

    // Create change log search criteria structure.
    ChangeLogRecordSearchCriteria searchCriteria = new ChangeLogRecordSearchCriteria();
    searchCriteria.setPageSize(10);
    searchCriteria.setObjectId(advertiserId);
    // The following field has been filled in to choose advertiser change
    // logs. This values was determined using GetChangeLogObjectTypes.java.
    searchCriteria.setObjectTypeId(1L);

    // Get change log record set.
    ChangeLogRecordSet changeLogRecordSet = service.getChangeLogRecords(searchCriteria);

    // Set up a formatter to make the change log timestamps human-readable.
    SimpleDateFormat dateFormat = new SimpleDateFormat("d MMM yyyy HH:mm");

    // Display the contents of each change log record
View Full Code Here

    CreativeAssignment creativeAssignment = new CreativeAssignment();
    creativeAssignment.setActive(true);
    creativeAssignment.setCreativeId(creativeId);

    // Create the click through URL.
    ClickThroughUrl clickThroughUrl = new ClickThroughUrl();
    clickThroughUrl.setDefaultLandingPageUsed(true);
    clickThroughUrl.setLandingPageId(0);
    creativeAssignment.setClickThroughUrl(clickThroughUrl);

    // Create the creative assignments.
    CreativeAssignment[] creativeAssignments = new CreativeAssignment[]{creativeAssignment};
    rotationGroup.setCreativeAssignments(creativeAssignments);
View Full Code Here

      DfaServices dfaServices, DfaSession session, String contentCategoryName) throws Exception {
    // Request the service.
    ContentCategoryRemote service = dfaServices.get(session, ContentCategoryRemote.class);

    // Create the content category.
    ContentCategory contentCategory = new ContentCategory();
    contentCategory.setId(0);
    contentCategory.setName(contentCategoryName);

    // Save the content category.
    ContentCategorySaveResult contentCategorySaveResult =
        service.saveContentCategory(contentCategory);
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfa.axis.v1_19.Placement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.