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

Examples of com.google.api.ads.dfp.jaxws.v201208.CustomTargetingKey


    // Get the CustomTargetingService.
    CustomTargetingServiceInterface customTargetingService =
        dfpServices.get(session, CustomTargetingServiceInterface.class);

    // Create predefined key.
    CustomTargetingKey genderKey = new CustomTargetingKey();
    genderKey.setDisplayName("gender");
    genderKey.setName("g" + new Random().nextInt(1000));
    genderKey.setType(CustomTargetingKeyType.PREDEFINED);

    // Create predefined key that may be used for content targeting.
    CustomTargetingKey genreKey = new CustomTargetingKey();
    genreKey.setDisplayName("genre");
    genreKey.setName("genre" + new Random().nextInt(1000));
    genreKey.setType(CustomTargetingKeyType.PREDEFINED);

    // Create free-form key.
    CustomTargetingKey carModelKey = new CustomTargetingKey();
    carModelKey.setDisplayName("car model");
    carModelKey.setName("c" + new Random().nextInt(1000));
    carModelKey.setType(CustomTargetingKeyType.FREEFORM);

    // Create the custom targeting keys on the server.
    CustomTargetingKey[] customTargetingKeys = customTargetingService.createCustomTargetingKeys(
        new CustomTargetingKey[] {genderKey, genreKey, carModelKey});

    for (CustomTargetingKey createdCustomTargetingKey : customTargetingKeys) {
      System.out.printf("A custom targeting key with ID \"%d\", name \"%s\", and display name "
          + "\"%s\" was created.\n", createdCustomTargetingKey.getId(),
          createdCustomTargetingKey.getName(), createdCustomTargetingKey.getDisplayName());
    }

    // Set the created custom targeting keys.
    genderKey = customTargetingKeys[0];
    genreKey = customTargetingKeys[1];
    carModelKey = customTargetingKeys[2];

    // Create custom targeting value for the predefined gender key.
    CustomTargetingValue genderMaleValue = new CustomTargetingValue();
    genderMaleValue.setCustomTargetingKeyId(genderKey.getId());
    genderMaleValue.setDisplayName("male");
    // Name is set to 1 so that the actual name can be hidden from website
    // users.
    genderMaleValue.setName("1");
    genderMaleValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    CustomTargetingValue genderFemaleValue = new CustomTargetingValue();
    genderFemaleValue.setCustomTargetingKeyId(genderKey.getId());
    genderFemaleValue.setDisplayName("female");
    // Name is set to 2 so that the actual name can be hidden from website
    // users.
    genderFemaleValue.setName("2");
    genderFemaleValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    // Create custom targeting value for the predefined genre key.
    CustomTargetingValue genreComedyValue = new CustomTargetingValue();
    genreComedyValue.setCustomTargetingKeyId(genreKey.getId());
    genreComedyValue.setDisplayName("comedy");
    genreComedyValue.setName("comedy");
    genreComedyValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    CustomTargetingValue genreDramaValue = new CustomTargetingValue();
    genreDramaValue.setCustomTargetingKeyId(genreKey.getId());
    genreDramaValue.setDisplayName("drama");
    genreDramaValue.setName("drama");
    genreDramaValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    // Create custom targeting value for the free-form car model key. These are
    // values that would be suggested in the UI or can be used when targeting
    // with a FreeFormCustomCriteria.
    CustomTargetingValue carModelHondaValue = new CustomTargetingValue();
    carModelHondaValue.setCustomTargetingKeyId(carModelKey.getId());
    carModelHondaValue.setDisplayName("~honda");
    carModelHondaValue.setName("honda");
    // A match type of broad will match anything including "honda",
    // i.e. "~honda".
    carModelHondaValue.setMatchType(CustomTargetingValueMatchType.BROAD);
View Full Code Here


    // Get the CustomTargetingService.
    CustomTargetingServiceInterface customTargetingService =
        dfpServices.get(session, CustomTargetingServiceInterface.class);

    // Create predefined key.
    CustomTargetingKey genderKey = new CustomTargetingKey();
    genderKey.setDisplayName("gender");
    genderKey.setName("g" + new Random().nextInt(1000));
    genderKey.setType(CustomTargetingKeyType.PREDEFINED);

    // Create predefined key that may be used for content targeting.
    CustomTargetingKey genreKey = new CustomTargetingKey();
    genreKey.setDisplayName("genre");
    genreKey.setName("genre" + new Random().nextInt(1000));
    genreKey.setType(CustomTargetingKeyType.PREDEFINED);

    // Create free-form key.
    CustomTargetingKey carModelKey = new CustomTargetingKey();
    carModelKey.setDisplayName("car model");
    carModelKey.setName("c" + new Random().nextInt(1000));
    carModelKey.setType(CustomTargetingKeyType.FREEFORM);

    // Create the custom targeting keys on the server.
    CustomTargetingKey[] customTargetingKeys = customTargetingService.createCustomTargetingKeys(
        new CustomTargetingKey[] {genderKey, genreKey, carModelKey});

    for (CustomTargetingKey createdCustomTargetingKey : customTargetingKeys) {
      System.out.printf("A custom targeting key with ID \"%d\", name \"%s\", and display name "
          + "\"%s\" was created.\n", createdCustomTargetingKey.getId(),
          createdCustomTargetingKey.getName(), createdCustomTargetingKey.getDisplayName());
    }

    // Set the created custom targeting keys.
    genderKey = customTargetingKeys[0];
    genreKey = customTargetingKeys[1];
    carModelKey = customTargetingKeys[2];

    // Create custom targeting value for the predefined gender key.
    CustomTargetingValue genderMaleValue = new CustomTargetingValue();
    genderMaleValue.setCustomTargetingKeyId(genderKey.getId());
    genderMaleValue.setDisplayName("male");
    // Name is set to 1 so that the actual name can be hidden from website
    // users.
    genderMaleValue.setName("1");
    genderMaleValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    CustomTargetingValue genderFemaleValue = new CustomTargetingValue();
    genderFemaleValue.setCustomTargetingKeyId(genderKey.getId());
    genderFemaleValue.setDisplayName("female");
    // Name is set to 2 so that the actual name can be hidden from website
    // users.
    genderFemaleValue.setName("2");
    genderFemaleValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    // Create custom targeting value for the predefined genre key.
    CustomTargetingValue genreComedyValue = new CustomTargetingValue();
    genreComedyValue.setCustomTargetingKeyId(genreKey.getId());
    genreComedyValue.setDisplayName("comedy");
    genreComedyValue.setName("comedy");
    genreComedyValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    CustomTargetingValue genreDramaValue = new CustomTargetingValue();
    genreDramaValue.setCustomTargetingKeyId(genreKey.getId());
    genreDramaValue.setDisplayName("drama");
    genreDramaValue.setName("drama");
    genreDramaValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    // Create custom targeting value for the free-form car model key. These are
    // values that would be suggested in the UI or can be used when targeting
    // with a FreeFormCustomCriteria.
    CustomTargetingValue carModelHondaValue = new CustomTargetingValue();
    carModelHondaValue.setCustomTargetingKeyId(carModelKey.getId());
    carModelHondaValue.setDisplayName("~honda");
    carModelHondaValue.setName("honda");
    // A match type of broad will match anything including "honda",
    // i.e. "~honda".
    carModelHondaValue.setMatchType(CustomTargetingValueMatchType.BROAD);
View Full Code Here

    // Get the CustomTargetingService.
    CustomTargetingServiceInterface customTargetingService =
        dfpServices.get(session, CustomTargetingServiceInterface.class);

    // Create predefined key.
    CustomTargetingKey genderKey = new CustomTargetingKey();
    genderKey.setDisplayName("gender");
    genderKey.setName("g" + new Random().nextInt(1000));
    genderKey.setType(CustomTargetingKeyType.PREDEFINED);

    // Create predefined key that may be used for content targeting.
    CustomTargetingKey genreKey = new CustomTargetingKey();
    genreKey.setDisplayName("genre");
    genreKey.setName("genre" + new Random().nextInt(1000));
    genreKey.setType(CustomTargetingKeyType.PREDEFINED);

    // Create free-form key.
    CustomTargetingKey carModelKey = new CustomTargetingKey();
    carModelKey.setDisplayName("car model");
    carModelKey.setName("c" + new Random().nextInt(1000));
    carModelKey.setType(CustomTargetingKeyType.FREEFORM);

    // Create the custom targeting keys on the server.
    CustomTargetingKey[] customTargetingKeys = customTargetingService.createCustomTargetingKeys(
        new CustomTargetingKey[] {genderKey, genreKey, carModelKey});

    for (CustomTargetingKey createdCustomTargetingKey : customTargetingKeys) {
      System.out.printf("A custom targeting key with ID \"%d\", name \"%s\", and display name "
          + "\"%s\" was created.\n", createdCustomTargetingKey.getId(),
          createdCustomTargetingKey.getName(), createdCustomTargetingKey.getDisplayName());
    }

    // Set the created custom targeting keys.
    genderKey = customTargetingKeys[0];
    genreKey = customTargetingKeys[1];
    carModelKey = customTargetingKeys[2];

    // Create custom targeting value for the predefined gender key.
    CustomTargetingValue genderMaleValue = new CustomTargetingValue();
    genderMaleValue.setCustomTargetingKeyId(genderKey.getId());
    genderMaleValue.setDisplayName("male");
    // Name is set to 1 so that the actual name can be hidden from website
    // users.
    genderMaleValue.setName("1");
    genderMaleValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    CustomTargetingValue genderFemaleValue = new CustomTargetingValue();
    genderFemaleValue.setCustomTargetingKeyId(genderKey.getId());
    genderFemaleValue.setDisplayName("female");
    // Name is set to 2 so that the actual name can be hidden from website
    // users.
    genderFemaleValue.setName("2");
    genderFemaleValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    // Create custom targeting value for the predefined genre key.
    CustomTargetingValue genreComedyValue = new CustomTargetingValue();
    genreComedyValue.setCustomTargetingKeyId(genreKey.getId());
    genreComedyValue.setDisplayName("comedy");
    genreComedyValue.setName("comedy");
    genreComedyValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    CustomTargetingValue genreDramaValue = new CustomTargetingValue();
    genreDramaValue.setCustomTargetingKeyId(genreKey.getId());
    genreDramaValue.setDisplayName("drama");
    genreDramaValue.setName("drama");
    genreDramaValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    // Create custom targeting value for the free-form car model key. These are
    // values that would be suggested in the UI or can be used when targeting
    // with a FreeFormCustomCriteria.
    CustomTargetingValue carModelHondaValue = new CustomTargetingValue();
    carModelHondaValue.setCustomTargetingKeyId(carModelKey.getId());
    carModelHondaValue.setDisplayName("~honda");
    carModelHondaValue.setName("honda");
    // A match type of broad will match anything including "honda",
    // i.e. "~honda".
    carModelHondaValue.setMatchType(CustomTargetingValueMatchType.BROAD);
View Full Code Here

    // Get the CustomTargetingService.
    CustomTargetingServiceInterface customTargetingService =
        dfpServices.get(session, CustomTargetingServiceInterface.class);

    // Create predefined key.
    CustomTargetingKey genderKey = new CustomTargetingKey();
    genderKey.setDisplayName("gender");
    genderKey.setName("g" + new Random().nextInt(1000));
    genderKey.setType(CustomTargetingKeyType.PREDEFINED);

    // Create predefined key that may be used for content targeting.
    CustomTargetingKey genreKey = new CustomTargetingKey();
    genreKey.setDisplayName("genre");
    genreKey.setName("genre" + new Random().nextInt(1000));
    genreKey.setType(CustomTargetingKeyType.PREDEFINED);

    // Create free-form key.
    CustomTargetingKey carModelKey = new CustomTargetingKey();
    carModelKey.setDisplayName("car model");
    carModelKey.setName("c" + new Random().nextInt(1000));
    carModelKey.setType(CustomTargetingKeyType.FREEFORM);

    // Create the custom targeting keys on the server.
    CustomTargetingKey[] customTargetingKeys = customTargetingService.createCustomTargetingKeys(
        new CustomTargetingKey[] {genderKey, genreKey, carModelKey});

    for (CustomTargetingKey createdCustomTargetingKey : customTargetingKeys) {
      System.out.printf("A custom targeting key with ID \"%d\", name \"%s\", and display name "
          + "\"%s\" was created.\n", createdCustomTargetingKey.getId(),
          createdCustomTargetingKey.getName(), createdCustomTargetingKey.getDisplayName());
    }

    // Set the created custom targeting keys.
    genderKey = customTargetingKeys[0];
    genreKey = customTargetingKeys[1];
    carModelKey = customTargetingKeys[2];

    // Create custom targeting value for the predefined gender key.
    CustomTargetingValue genderMaleValue = new CustomTargetingValue();
    genderMaleValue.setCustomTargetingKeyId(genderKey.getId());
    genderMaleValue.setDisplayName("male");
    // Name is set to 1 so that the actual name can be hidden from website
    // users.
    genderMaleValue.setName("1");
    genderMaleValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    CustomTargetingValue genderFemaleValue = new CustomTargetingValue();
    genderFemaleValue.setCustomTargetingKeyId(genderKey.getId());
    genderFemaleValue.setDisplayName("female");
    // Name is set to 2 so that the actual name can be hidden from website
    // users.
    genderFemaleValue.setName("2");
    genderFemaleValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    // Create custom targeting value for the predefined genre key.
    CustomTargetingValue genreComedyValue = new CustomTargetingValue();
    genreComedyValue.setCustomTargetingKeyId(genreKey.getId());
    genreComedyValue.setDisplayName("comedy");
    genreComedyValue.setName("comedy");
    genreComedyValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    CustomTargetingValue genreDramaValue = new CustomTargetingValue();
    genreDramaValue.setCustomTargetingKeyId(genreKey.getId());
    genreDramaValue.setDisplayName("drama");
    genreDramaValue.setName("drama");
    genreDramaValue.setMatchType(CustomTargetingValueMatchType.EXACT);

    // Create custom targeting value for the free-form car model key. These are
    // values that would be suggested in the UI or can be used when targeting
    // with a FreeFormCustomCriteria.
    CustomTargetingValue carModelHondaValue = new CustomTargetingValue();
    carModelHondaValue.setCustomTargetingKeyId(carModelKey.getId());
    carModelHondaValue.setDisplayName("~honda");
    carModelHondaValue.setName("honda");
    // A match type of broad will match anything including "honda",
    // i.e. "~honda".
    carModelHondaValue.setMatchType(CustomTargetingValueMatchType.BROAD);
View Full Code Here

    textValue2.setValue("value2");

    textValue3 = new TextValue();
    textValue3.setValue("value3");

    booleanValue1 = new BooleanValue();
    booleanValue1.setValue(false);

    booleanValue2 = new BooleanValue();
    booleanValue2.setValue(true);

    booleanValue3 = new BooleanValue();
    booleanValue3.setValue(false);

    numberValue1 = new NumberValue();
    numberValue1.setValue("1");
View Full Code Here

  }
 
  @Test
  public void testToString_null() {
    assertEquals("", Pql.toString(new TextValue()));
    assertEquals("", Pql.toString(new BooleanValue()));
    assertEquals("", Pql.toString(new NumberValue()));
    assertEquals("", Pql.toString(new DateTimeValue()));   
  }
View Full Code Here

      return (Value) value;
    } else if (value == null) {
      return new TextValue();
    } else {
      if (value instanceof Boolean) {
        BooleanValue booleanValue = new BooleanValue();
        booleanValue.setValue((Boolean) value);
        return booleanValue;
      } else if (value instanceof Double || value instanceof Long || value instanceof Integer) {
        NumberValue numberValue = new NumberValue();
        numberValue.setValue(value.toString());
        return numberValue;
View Full Code Here

  public PqlTest() {}

  @Before
  public void setUp() throws Exception {
    column1 = new ColumnType();
    column1.setLabelName("column1");

    column2 = new ColumnType();
    column2.setLabelName("column2");

    column3 = new ColumnType();
    column3.setLabelName("column3");

    textValue1 = new TextValue();
    textValue1.setValue("value1");
View Full Code Here

        .withNetworkCode("TEST_NETWORK_CODE")
        .build();

    CompanyServiceInterface companyService =
        new DfpServices().get(session, CompanyServiceInterface.class);
    List<Company> companies = companyService.createCompanies(Lists.newArrayList(new Company()));

    assertEquals(1234L, companies.get(0).getId().longValue());
    assertEquals(SoapRequestXmlProvider.getClientLoginSoapRequest(API_VERSION),
        testHttpServer.getLastRequestBody());
  }
View Full Code Here

        .withNetworkCode("TEST_NETWORK_CODE")
        .build();

    CompanyServiceInterface companyService =
        new DfpServices().get(session, CompanyServiceInterface.class);
    List<Company> companies = companyService.createCompanies(Lists.newArrayList(new Company()));

    assertEquals(1234L, companies.get(0).getId().longValue());
    assertEquals(SoapRequestXmlProvider.getOAuth2SoapRequest(API_VERSION),
        testHttpServer.getLastRequestBody());
    assertEquals("Bearer TEST_ACCESS_TOKEN", testHttpServer.getLastAuthorizationHttpHeader());
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.jaxws.v201208.CustomTargetingKey

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.