Package com.google.api.ads.dfp.v201306

Examples of com.google.api.ads.dfp.v201306.ActivityGroup


      // Set the ID of the activity group and the company to update it with.
      Integer activityGroupId = Integer.parseInt("INSERT_ACTIVITY_GROUP_ID_HERE");
      Long advertiserCompanyId = Long.parseLong("INSERT_ADVERTISER_COMPANY_ID_HERE");

      // Get the activity group.
      ActivityGroup activityGroup = activityGroupService.getActivityGroup(activityGroupId);

      long[] companyIds = Arrays.copyOf(
          activityGroup.getCompanyIds(), activityGroup.getCompanyIds().length + 1);

      companyIds[companyIds.length - 1] = advertiserCompanyId;

      // Update the companies.
      activityGroup.setCompanyIds(companyIds);

      // Update the activity group on the server.
      ActivityGroup[] activityGroups =
          activityGroupService.updateActivityGroups(new ActivityGroup[] {activityGroup});
View Full Code Here


      // Set the ID of the company for the activity group.
      Long advertiserCompanyId = Long.parseLong("INSERT_ADVERTISER_COMPANY_ID_HERE");

      // Create a short-term activity group.
      ActivityGroup shortTermActivityGroup = new ActivityGroup();
      shortTermActivityGroup.setName("Short-term activity group #" + new Random().nextLong());
      shortTermActivityGroup.setCompanyIds(new long[] {advertiserCompanyId});
      shortTermActivityGroup.setClicksLookback(1);
      shortTermActivityGroup.setImpressionsLookback(1);

      // Create a long-term activity group.
      ActivityGroup longTermActivityGroup = new ActivityGroup();
      longTermActivityGroup.setName("Long-term activity group #" + new Random().nextLong());
      longTermActivityGroup.setCompanyIds(new long[] {advertiserCompanyId});
      longTermActivityGroup.setClicksLookback(30);
      longTermActivityGroup.setImpressionsLookback(30);

      // Create the activity groups on the server.
      ActivityGroup[] activityGroups = activityGroupService.createActivityGroups(
          new ActivityGroup[] {shortTermActivityGroup, longTermActivityGroup});
View Full Code Here

      return (Value) value;
    } else if (value == null) {
      return new TextValue(null, null);
    } else {
      if (value instanceof Boolean) {
        return new BooleanValue(null, (Boolean) value);
      } else if (value instanceof Double) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof String) {
        return new TextValue(null, (String) value);
      } else if (value instanceof Long) {
View Full Code Here

      // Set the ID of the company to get.
      Long companyId = Long.parseLong("INSERT_COMPANY_ID_HERE");

      // Get the company.
      Company company = companyService.getCompany(companyId);

      if (company != null) {
        System.out.println("Company with ID \"" + company.getId()
            + "\", name \"" + company.getName()
            + "\", and type \"" + company.getType() + "\" was found.");
      } else {
        System.out.println("No company found for this ID.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

      // Create an array to store local company objects.
      Company[] companies = new Company[5];

      for (int i = 0; i < 5; i++) {
        Company company = new Company();
        company.setName("Advertiser #" + i);
        company.setType(CompanyType.ADVERTISER);
        companies[i] = company;
      }

      // Create the companies on the server.
      companies = companyService.createCompanies(companies);

      if (companies != null) {
        for (Company company : companies) {
          System.out.println("A company with ID \"" + company.getId()
              + "\", name \"" + company.getName()
              + "\", and type \"" + company.getType() + "\" was created.");
        }
      } else {
        System.out.println("No companies created.");
      }
    } catch (Exception e) {
View Full Code Here

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201306.COMPANY_SERVICE);

      // Set defaults for page and filterStatement.
      CompanyPage page = new CompanyPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all companies.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get companies by statement.
        page = companyService.getCompaniesByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Company company : page.getResults()) {
            System.out.println(i + ") Company with ID \"" + company.getId()
                + "\", name \"" + company.getName()
                + "\", and type \"" + company.getType() + "\" was found.");
            i++;
          }
        }

        offset += 500;
      } while (offset < page.getTotalResultSetSize());

      System.out.println("Number of results found: " + page.getTotalResultSetSize());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201306.COMPANY_SERVICE);

      // Set defaults for page and filterStatement.
      CompanyPage page = new CompanyPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all companies.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get companies by statement.
        page = companyService.getCompaniesByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Company company : page.getResults()) {
            System.out.println(i + ") Company with ID \"" + company.getId()
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201306.COMPANY_SERVICE);

      // Set the ID of the company to get.
      Long companyId = Long.parseLong("INSERT_COMPANY_ID_HERE");

      // Get the company.
      Company company = companyService.getCompany(companyId);

      if (company != null) {
        System.out.println("Company with ID \"" + company.getId()
            + "\", name \"" + company.getName()
            + "\", and type \"" + company.getType() + "\" was found.");
View Full Code Here

      // Set the ID of the contact to update.
      Long contactId = Long.parseLong("INSERT_CONTACT_ID_HERE");

      // Get the contact.
      Contact contact = contactService.getContact(contactId);

      // Update the address of the contact.
      contact.setAddress("123 New Street, New York, NY, 10011");

      // Update the contact on the server.
      Contact[] contacts = contactService.updateContacts(new Contact[] {contact});

      for (Contact updatedContact : contacts) {
View Full Code Here

      // Set the IDs of the companies for the contacts.
      Long advertiserCompanyId = Long.parseLong("INSERT_ADVERTISER_COMPANY_ID_HERE");
      Long agencyCompanyId = Long.parseLong("INSERT_AGENCY_COMPANY_ID_HERE");

      // Create an advertiser contact.
      Contact advertiserContact = new Contact();
      advertiserContact.setName("Mr. Advertiser #" + new Random().nextLong());
      advertiserContact.setEmail("advertiser@advertising.com");
      advertiserContact.setCompanyId(advertiserCompanyId);

      // Create an agency contact.
      Contact agencyContact = new Contact();
      agencyContact.setName("Ms. Agency #" + new Random().nextLong());
      agencyContact.setEmail("agency@agencies.com");
      agencyContact.setCompanyId(agencyCompanyId);

      // Create the contacts on the server.
      Contact[] contacts =
          contactService.createContacts(new Contact[] {advertiserContact, agencyContact});
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201306.ActivityGroup

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.