Package com.google.api.ads.dfp.axis.v201208

Examples of com.google.api.ads.dfp.axis.v201208.AdUnit


      // Set the ID of the ad unit to get.
      String adUnitId = "INSERT_AD_UNIT_ID_HERE";

      // Get the ad unit.
      AdUnit adUnit = inventoryService.getAdUnit(adUnitId);

      if (adUnit != null) {
        System.out.println("Ad unit with ID \"" + adUnit.getId()
            + "\", name \"" + adUnit.getName()
            + "\", and status \"" + adUnit.getStatus() + "\" was found.");
      } else {
        System.out.println("No ad unit found for this ID.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here


      // Find the root ad unit. rootAdUnit can also be set to child unit to
      // only build and display a portion of the tree.
      // i.e. AdUnit adUnit =
      //          inventoryService.getAdUnit("INSERT_AD_UNIT_HERE")
      AdUnit rootAdUnit = findRootAdUnit(user);

      if (rootAdUnit == null) {
        System.out.println("Could not build tree. No root ad unit found.");
      } else {
        buildAndDisplayAdUnitTree(rootAdUnit, allAdUnits);
View Full Code Here

      // Create an array to store local ad unit objects.
      AdUnit[] adUnits = new AdUnit[5];

      for (int i = 0; i < 5; i++) {
        AdUnit adUnit = new AdUnit();
        adUnit.setName("Ad_Unit_" + i);
        adUnit.setParentId(effectiveRootAdUnitId);
        adUnit.setDescription("Ad unit description.");
        adUnit.setTargetWindow(AdUnitTargetWindow.BLANK);

        // Create ad unit size.
        AdUnitSize adUnitSize = new AdUnitSize();
        adUnitSize.setSize(new Size(300, 250, false));
        adUnitSize.setEnvironmentType(EnvironmentType.BROWSER);

        // Set the size of possible creatives that can match this ad unit.
        adUnit.setAdUnitSizes(new AdUnitSize[] {adUnitSize});

        adUnits[i] = adUnit;
      }

      // Create the ad units on the server.
      adUnits = inventoryService.createAdUnits(adUnits);

      if (adUnits != null) {
        for (AdUnit adUnit : adUnits) {
          System.out.println("An ad unit with ID \"" + adUnit.getId()
              + "\" was created under parent with ID \"" + adUnit.getParentId()
              + "\".");
        }
      } else {
        System.out.println("No ad units created.");
      }
View Full Code Here

      // Set the parent ad unit's ID for all ad units to be created under.
      String effectiveRootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

      // Create local ad unit object.
      AdUnit adUnit = new AdUnit();
      adUnit.setName("Mobile_Ad_Unit");
      adUnit.setParentId(effectiveRootAdUnitId);
      adUnit.setDescription("Ad unit description.");
      adUnit.setTargetWindow(AdUnitTargetWindow.BLANK);
      adUnit.setTargetPlatform(TargetPlatform.MOBILE);
      adUnit.setMobilePlatform(MobilePlatform.APPLICATION);

      // Create ad unit size.
      AdUnitSize adUnitSize = new AdUnitSize();
      adUnitSize.setSize(new Size(400, 300, false));
      adUnitSize.setEnvironmentType(EnvironmentType.BROWSER);

      // Set the size of possible creatives that can match this ad unit.
      adUnit.setAdUnitSizes(new AdUnitSize[] {adUnitSize});

      // Create the ad unit on the server.
      adUnit = inventoryService.createAdUnit(adUnit);

      if (adUnit != null) {
        System.out.println("An ad unit with ID \"" + adUnit.getId()
            + "\" was created under parent with ID \"" + adUnit.getParentId()
            + "\".");
      } else {
        System.out.println("No ad units created.");
      }
    } catch (Exception e) {
View Full Code Here

      // Set the parent ad unit's ID for all ad units to be created under.
      String effectiveRootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

      // Create local ad unit object.
      AdUnit adUnit = new AdUnit();
      adUnit.setName("Video_Ad_Unit");
      adUnit.setParentId(effectiveRootAdUnitId);
      adUnit.setDescription("Ad unit description.");
      adUnit.setTargetWindow(AdUnitTargetWindow.BLANK);
      adUnit.setExplicitlyTargeted(true);
      adUnit.setTargetPlatform(TargetPlatform.WEB);

      // Create master ad unit size.
      AdUnitSize masterAdUnitSize = new AdUnitSize();
      masterAdUnitSize.setSize(new Size(400, 300, false));
      masterAdUnitSize.setEnvironmentType(EnvironmentType.VIDEO_PLAYER);

      // Create companion sizes.
      AdUnitSize companionAdUnitSize1 = new AdUnitSize();
      companionAdUnitSize1.setSize(new Size(300, 250, false));
      companionAdUnitSize1.setEnvironmentType(EnvironmentType.BROWSER);

      AdUnitSize companionAdUnitSize2 = new AdUnitSize();
      companionAdUnitSize2.setSize(new Size(728, 90, false));
      companionAdUnitSize2.setEnvironmentType(EnvironmentType.BROWSER);

      // Add companions to master ad unit size.
      masterAdUnitSize.setCompanions(new AdUnitSize[] {companionAdUnitSize1, companionAdUnitSize2});

      // Set the size of possible creatives that can match this ad unit.
      adUnit.setAdUnitSizes(new AdUnitSize[] {masterAdUnitSize});

      // Create the ad unit on the server.
      adUnit = inventoryService.createAdUnit(adUnit);

      if (adUnit != null) {
        System.out.println("An ad unit with ID \"" + adUnit.getId()
            + "\" was created under parent with ID \"" + adUnit.getParentId()
            + "\".");
      } else {
        System.out.println("No ad units created.");
      }
    } catch (Exception e) {
View Full Code Here

      // Set the parent ad unit's ID for all ad units to be created under.
      String effectiveRootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

      // Create local ad unit object.
      AdUnit adUnit = new AdUnit();
      adUnit.setName("Mobile_Ad_Unit");
      adUnit.setParentId(effectiveRootAdUnitId);
      adUnit.setDescription("Ad unit description.");
      adUnit.setTargetWindow(AdUnitTargetWindow.BLANK);
      adUnit.setTargetPlatform(TargetPlatform.MOBILE);
      adUnit.setMobilePlatform(MobilePlatform.APPLICATION);

      // Create ad unit size.
      AdUnitSize adUnitSize = new AdUnitSize();
      adUnitSize.setSize(new Size(400, 300, false));
      adUnitSize.setEnvironmentType(EnvironmentType.BROWSER);

      // Set the size of possible creatives that can match this ad unit.
      adUnit.setAdUnitSizes(new AdUnitSize[] {adUnitSize});

      // Create the ad unit on the server.
      adUnit = inventoryService.createAdUnit(adUnit);

      if (adUnit != null) {
        System.out.println("An ad unit with ID \"" + adUnit.getId()
            + "\" was created under parent with ID \"" + adUnit.getParentId()
            + "\".");
      } else {
        System.out.println("No ad units created.");
      }
    } catch (Exception e) {
View Full Code Here

      // Set the parent ad unit's ID for all ad units to be created under.
      String effectiveRootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

      // Create local ad unit object.
      AdUnit adUnit = new AdUnit();
      adUnit.setName("Video_Ad_Unit");
      adUnit.setParentId(effectiveRootAdUnitId);
      adUnit.setDescription("Ad unit description.");
      adUnit.setTargetWindow(AdUnitTargetWindow.BLANK);
      adUnit.setExplicitlyTargeted(true);
      adUnit.setTargetPlatform(TargetPlatform.WEB);

      // Create master ad unit size.
      AdUnitSize masterAdUnitSize = new AdUnitSize();
      masterAdUnitSize.setSize(new Size(400, 300, false));
      masterAdUnitSize.setEnvironmentType(EnvironmentType.VIDEO_PLAYER);

      // Create companion sizes.
      AdUnitSize companionAdUnitSize1 = new AdUnitSize();
      companionAdUnitSize1.setSize(new Size(300, 250, false));
      companionAdUnitSize1.setEnvironmentType(EnvironmentType.BROWSER);

      AdUnitSize companionAdUnitSize2 = new AdUnitSize();
      companionAdUnitSize2.setSize(new Size(728, 90, false));
      companionAdUnitSize2.setEnvironmentType(EnvironmentType.BROWSER);

      // Add companions to master ad unit size.
      masterAdUnitSize.setCompanions(new AdUnitSize[] {companionAdUnitSize1, companionAdUnitSize2});

      // Set the size of possible creatives that can match this ad unit.
      adUnit.setAdUnitSizes(new AdUnitSize[] {masterAdUnitSize});

      // Create the ad unit on the server.
      adUnit = inventoryService.createAdUnit(adUnit);

      if (adUnit != null) {
        System.out.println("An ad unit with ID \"" + adUnit.getId()
            + "\" was created under parent with ID \"" + adUnit.getParentId()
            + "\".");
      } else {
        System.out.println("No ad units created.");
      }
    } catch (Exception e) {
View Full Code Here

      // Set the ID of the ad unit to get.
      String adUnitId = "INSERT_AD_UNIT_ID_HERE";

      // Get the ad unit.
      AdUnit adUnit = inventoryService.getAdUnit(adUnitId);

      if (adUnit != null) {
        System.out.println("Ad unit with ID \"" + adUnit.getId()
            + "\", name \"" + adUnit.getName()
            + "\", and status \"" + adUnit.getStatus() + "\" was found.");
      } else {
        System.out.println("No ad unit found for this ID.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

      // Create an array to store local ad unit objects.
      AdUnit[] adUnits = new AdUnit[5];

      for (int i = 0; i < 5; i++) {
        AdUnit adUnit = new AdUnit();
        adUnit.setName("Ad_Unit_" + i);
        adUnit.setParentId(effectiveRootAdUnitId);
        adUnit.setDescription("Ad unit description.");
        adUnit.setTargetWindow(AdUnitTargetWindow.BLANK);

        // Create ad unit size.
        AdUnitSize adUnitSize = new AdUnitSize();
        adUnitSize.setSize(new Size(300, 250, false));
        adUnitSize.setEnvironmentType(EnvironmentType.BROWSER);

        // Set the size of possible creatives that can match this ad unit.
        adUnit.setAdUnitSizes(new AdUnitSize[] {adUnitSize});

        adUnits[i] = adUnit;
      }

      // Create the ad units on the server.
      adUnits = inventoryService.createAdUnits(adUnits);

      if (adUnits != null) {
        for (AdUnit adUnit : adUnits) {
          System.out.println("An ad unit with ID \"" + adUnit.getId()
              + "\" was created under parent with ID \"" + adUnit.getParentId()
              + "\".");
        }
      } else {
        System.out.println("No ad units created.");
      }
View Full Code Here

      // Find the root ad unit. rootAdUnit can also be set to child unit to
      // only build and display a portion of the tree.
      // i.e. AdUnit adUnit =
      //          inventoryService.getAdUnit("INSERT_AD_UNIT_HERE")
      AdUnit rootAdUnit = findRootAdUnit(user);

      if (rootAdUnit == null) {
        System.out.println("Could not build tree. No root ad unit found.");
      } else {
        buildAndDisplayAdUnitTree(rootAdUnit, allAdUnits);
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.axis.v201208.AdUnit

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.