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

Examples of com.google.api.ads.dfa.axis.v1_20.PlacementRemote


  private static final String TOKEN = "INSERT_TOKEN_HERE";
  private static final String APPLICATION_NAME = "INSERT_APPLICATION_NAME_HERE";

  public static void runExample(DfaServices dfaServices, DfaSession session) throws Exception {
    // Request the placement service from the service client factory.
    PlacementRemote placementService = dfaServices.get(session, PlacementRemote.class);

    // Get placement types.
    PlacementType[] placements = placementService.getPlacementTypes();

    // Display placement type names and IDs.
    for (PlacementType result : placements) {
      System.out.printf("Placement type with name \"%s\" and ID \"%s\" was found.%n",
          result.getName(), result.getId());
View Full Code Here


  private static final String SEARCH_STRING = "INSERT_SEARCH_CRITERIA_HERE";

  public static void runExample(
      DfaServices dfaServices, DfaSession session, String searchString) throws Exception {
    // Request the placement service from the service client factory.
    PlacementRemote placementService = dfaServices.get(session, PlacementRemote.class);

    // Set placement search criteria.
    PlacementSearchCriteria searchCriteria = new PlacementSearchCriteria();
    searchCriteria.setPageSize(10);
    searchCriteria.setSearchString(searchString);

    // Get placement types.
    PlacementRecordSet placements = placementService.getPlacementsByCriteria(searchCriteria);

    // Display placment names and IDs.
    if (placements.getRecords() != null) {
      for (Placement result : placements.getRecords()) {
        System.out.printf("Placment with name \"%s\" and ID \"%s\" was found.%n",
View Full Code Here

*/
public class GetPlacementTypes {

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

    // Get placement types.
    PlacementType[] placements = service.getPlacementTypes();

    // Display placement type names and IDs.
    for (PlacementType result : placements) {
      System.out.println("Placement type with name \"" + result.getName()
          + "\" and ID \"" + result.getId() + "\" was found.");
View Full Code Here

*/
public class GetPricingTypes {

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

    // Get placement pricing types.
    PricingType[] pricingTypes = service.getPricingTypes();

    // Display placement pricing type names and IDs.
    for (PricingType result : pricingTypes) {
      System.out.println("Pricing type with name \"" + result.getName()
          + "\" and ID \"" + result.getId() + "\" was found.");
View Full Code Here

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

    // Set placement tag search criteria.
    PlacementTagCriteria placementTagCriteria = new PlacementTagCriteria();
    placementTagCriteria.setId(placementId);

    // Get placement tag options.
    PlacementTagOption[] placementTagOptions = service.getRegularPlacementTagOptions();

    long[] tagOptionIds = new long[placementTagOptions.length];

    // Add all types of tags to the tag option structure.
    for (int i = 0; i < placementTagOptions.length; i++) {
      tagOptionIds[i] = placementTagOptions[i].getId();
    }

    placementTagCriteria.setTagOptionIds(tagOptionIds);
    PlacementTagCriteria[] placementTagCriterias =
        new PlacementTagCriteria[]{placementTagCriteria};

    // Get HTML tags for the placements.
    PlacementTagData placementTagData =
        service.getPlacementTagData(campaignId, placementTagCriterias);

    // Display tags for the placement ID used as criteria.
    System.out.println("Iframe/JavaScript tag for placement \""
        + placementTagData.getPlacementTagInfos()[0].getPlacement().getName() + "\" is \n"
        + placementTagData.getPlacementTagInfos()[0].getIframeJavaScriptTag() + "\n");
View Full Code Here

  private static final String SIZE_ID = "INSERT_SIZE_ID_HERE";

  public static void runExample(DfaServices dfaServices, DfaSession session, String placementName,
      long dfaSiteId, long campaignId, int pricingType, long sizeId) throws Exception {
    // Request the placement service from the service client factory.
    PlacementRemote placementService = dfaServices.get(session, PlacementRemote.class);

    // Create the placement.
    Placement placement = new Placement();
    placement.setId(0);
    placement.setName(placementName);
    placement.setCampaignId(campaignId);
    placement.setDfaSiteId(dfaSiteId);
    placement.setSizeId(sizeId);
    // The type ID for regular agency paid placements is 3. See
    // GetPlacementTypes.java
    placement.setPlacementType(3);

    // Set the pricing schedule for the placement.
    PricingSchedule pricingSchedule = new PricingSchedule();
    Calendar startDate = Calendar.getInstance();
    Calendar endDate = Calendar.getInstance();
    endDate.add(Calendar.MONTH, 1);
    pricingSchedule.setStartDate(startDate);
    pricingSchedule.setEndDate(endDate);
    pricingSchedule.setPricingType(pricingType);
    placement.setPricingSchedule(pricingSchedule);

    // Set the placement tag settings.
    TagSettings tagSettings = new TagSettings();
    PlacementTagOption[] placementTagOptions = placementService.getRegularPlacementTagOptions();
    int[] tagTypes = new int[placementTagOptions.length];

    for (int i = 0; i < placementTagOptions.length; i++) {
      tagTypes[i] = (int) placementTagOptions[i].getId();
    }

    tagSettings.setTagTypes(tagTypes);
    placement.setTagSettings(tagSettings);

    // Save the placement.
    PlacementSaveResult placementSaveResult = placementService.savePlacement(placement);

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

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

    // Create advertiser group structure.
    AdvertiserGroup advertiserGroup = new AdvertiserGroup();
    advertiserGroup.setId(0);
    advertiserGroup.setName(advertiserGroupName);

    // Create advertiser group.
    AdvertiserGroupSaveResult advertiserGroupSaveResult =
        service.saveAdvertiserGroup(advertiserGroup);
View Full Code Here

    AdvertiserGroupSearchCriteria advGroupSearchCriteria = new AdvertiserGroupSearchCriteria();
    advGroupSearchCriteria.setPageSize(10);
    advGroupSearchCriteria.setSearchString(searchString);

    // Get advertiser group record set.
    AdvertiserGroupRecordSet advertiserGroupRecordSet =
        service.getAdvertiserGroups(advGroupSearchCriteria);

    // Display advertiser group names, IDs and advertiser count.
    if (advertiserGroupRecordSet.getRecords() != null) {
      for (AdvertiserGroup result : advertiserGroupRecordSet.getRecords()) {
        System.out.println("Advertiser Group with name \"" + result.getName()
            + "\", ID \"" + result.getId()
            + "\", containing " + result.getAdvertiserCount()
            + " advertisers was found.");
      }
View Full Code Here

  private static final String SEARCH_STRING = "INSERT_SEARCH_CRITERIA_HERE";

  public static void runExample(
      DfaServices dfaServices, DfaSession session, String searchString) throws Exception {
    // Request the service.
    AdvertiserGroupRemote service = dfaServices.get(session, AdvertiserGroupRemote.class);

    // Create advertiser group search criteria structure.
    AdvertiserGroupSearchCriteria advGroupSearchCriteria = new AdvertiserGroupSearchCriteria();
    advGroupSearchCriteria.setPageSize(10);
    advGroupSearchCriteria.setSearchString(searchString);

    // Get advertiser group record set.
    AdvertiserGroupRecordSet advertiserGroupRecordSet =
        service.getAdvertiserGroups(advGroupSearchCriteria);

    // Display advertiser group names, IDs and advertiser count.
    if (advertiserGroupRecordSet.getRecords() != null) {
      for (AdvertiserGroup result : advertiserGroupRecordSet.getRecords()) {
        System.out.println("Advertiser Group with name \"" + result.getName()
View Full Code Here

  private static final String ADVERTISER_GROUP_NAME = "INSERT_ADVERTISER_GROUP_NAME_HERE";

  public static void runExample(
      DfaServices dfaServices, DfaSession session, String advertiserGroupName) throws Exception {
    // Request the service.
    AdvertiserGroupRemote service = dfaServices.get(session, AdvertiserGroupRemote.class);

    // Create advertiser group structure.
    AdvertiserGroup advertiserGroup = new AdvertiserGroup();
    advertiserGroup.setId(0);
    advertiserGroup.setName(advertiserGroupName);

    // Create advertiser group.
    AdvertiserGroupSaveResult advertiserGroupSaveResult =
        service.saveAdvertiserGroup(advertiserGroup);

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

TOP

Related Classes of com.google.api.ads.dfa.axis.v1_20.PlacementRemote

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.