Class AudienceInsightsServiceClient

java.lang.Object
com.google.ads.googleads.v18.services.AudienceInsightsServiceClient
All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class AudienceInsightsServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Audience Insights Service helps users find information about groups of people and how they can be reached with Google Ads. Accessible to allowlisted customers only.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (AudienceInsightsServiceClient audienceInsightsServiceClient =
     AudienceInsightsServiceClient.create()) {
   String customerId = "customerId-1581184615";
   BasicInsightsAudience baselineAudience = BasicInsightsAudience.newBuilder().build();
   BasicInsightsAudience specificAudience = BasicInsightsAudience.newBuilder().build();
   GenerateInsightsFinderReportResponse response =
       audienceInsightsServiceClient.generateInsightsFinderReport(
           customerId, baselineAudience, specificAudience);
 }
 

Note: close() needs to be called on the AudienceInsightsServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

GenerateInsightsFinderReport

Creates a saved report that can be viewed in the Insights Finder tool.

List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • generateInsightsFinderReport(GenerateInsightsFinderReportRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • generateInsightsFinderReport(String customerId, BasicInsightsAudience baselineAudience, BasicInsightsAudience specificAudience)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • generateInsightsFinderReportCallable()

ListAudienceInsightsAttributes

Searches for audience attributes that can be used to generate insights.

List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listAudienceInsightsAttributes(ListAudienceInsightsAttributesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listAudienceInsightsAttributes(String customerId, List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions, String queryText)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listAudienceInsightsAttributesCallable()

ListInsightsEligibleDates

Lists date ranges for which audience insights data can be requested.

List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listInsightsEligibleDates(ListInsightsEligibleDatesRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listInsightsEligibleDatesCallable()

GenerateAudienceCompositionInsights

Returns a collection of attributes that are represented in an audience of interest, with metrics that compare each attribute's share of the audience with its share of a baseline audience.

List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • generateAudienceCompositionInsights(GenerateAudienceCompositionInsightsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • generateAudienceCompositionInsights(String customerId, InsightsAudience audience, List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • generateAudienceCompositionInsightsCallable()

GenerateSuggestedTargetingInsights

Returns a collection of targeting insights (e.g. targetable audiences) that are relevant to the requested audience.

List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • generateSuggestedTargetingInsights(GenerateSuggestedTargetingInsightsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • generateSuggestedTargetingInsightsCallable()

GenerateAudienceOverlapInsights

Returns a collection of audience attributes along with estimates of the overlap between their potential YouTube reach and that of a given input attribute.

List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • generateAudienceOverlapInsights(GenerateAudienceOverlapInsightsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • generateAudienceOverlapInsights(String customerId, LocationInfo countryLocation, AudienceInsightsAttribute primaryAttribute, List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • generateAudienceOverlapInsightsCallable()

GenerateTargetingSuggestionMetrics

Returns potential reach metrics for targetable audiences.

This method helps answer questions like "How many Men aged 18+ interested in Camping can be reached on YouTube?"

List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • generateTargetingSuggestionMetrics(GenerateTargetingSuggestionMetricsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • generateTargetingSuggestionMetrics(String customerId, List<BasicInsightsAudience> audiences)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • generateTargetingSuggestionMetricsCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of AudienceInsightsServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 AudienceInsightsServiceSettings audienceInsightsServiceSettings =
     AudienceInsightsServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 AudienceInsightsServiceClient audienceInsightsServiceClient =
     AudienceInsightsServiceClient.create(audienceInsightsServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 AudienceInsightsServiceSettings audienceInsightsServiceSettings =
     AudienceInsightsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 AudienceInsightsServiceClient audienceInsightsServiceClient =
     AudienceInsightsServiceClient.create(audienceInsightsServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

  • Constructor Details

    • AudienceInsightsServiceClient

      protected AudienceInsightsServiceClient(AudienceInsightsServiceSettings settings) throws IOException
      Constructs an instance of AudienceInsightsServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
      Throws:
      IOException
    • AudienceInsightsServiceClient

      protected AudienceInsightsServiceClient(AudienceInsightsServiceStub stub)
  • Method Details

    • create

      public static final AudienceInsightsServiceClient create() throws IOException
      Constructs an instance of AudienceInsightsServiceClient with default settings.
      Throws:
      IOException
    • create

      public static final AudienceInsightsServiceClient create(AudienceInsightsServiceSettings settings) throws IOException
      Constructs an instance of AudienceInsightsServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
      Throws:
      IOException
    • create

      Constructs an instance of AudienceInsightsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(AudienceInsightsServiceSettings).
    • getSettings

      public final AudienceInsightsServiceSettings getSettings()
    • getStub

      public AudienceInsightsServiceStub getStub()
    • generateInsightsFinderReport

      public final GenerateInsightsFinderReportResponse generateInsightsFinderReport(String customerId, BasicInsightsAudience baselineAudience, BasicInsightsAudience specificAudience)
      Creates a saved report that can be viewed in the Insights Finder tool.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         String customerId = "customerId-1581184615";
         BasicInsightsAudience baselineAudience = BasicInsightsAudience.newBuilder().build();
         BasicInsightsAudience specificAudience = BasicInsightsAudience.newBuilder().build();
         GenerateInsightsFinderReportResponse response =
             audienceInsightsServiceClient.generateInsightsFinderReport(
                 customerId, baselineAudience, specificAudience);
       }
       
      Parameters:
      customerId - Required. The ID of the customer.
      baselineAudience - Required. A baseline audience for this report, typically all people in a region.
      specificAudience - Required. The specific audience of interest for this report. The insights in the report will be based on attributes more prevalent in this audience than in the report's baseline audience.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • generateInsightsFinderReport

      public final GenerateInsightsFinderReportResponse generateInsightsFinderReport(GenerateInsightsFinderReportRequest request)
      Creates a saved report that can be viewed in the Insights Finder tool.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         GenerateInsightsFinderReportRequest request =
             GenerateInsightsFinderReportRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setBaselineAudience(BasicInsightsAudience.newBuilder().build())
                 .setSpecificAudience(BasicInsightsAudience.newBuilder().build())
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .build();
         GenerateInsightsFinderReportResponse response =
             audienceInsightsServiceClient.generateInsightsFinderReport(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • generateInsightsFinderReportCallable

      public final com.google.api.gax.rpc.UnaryCallable<GenerateInsightsFinderReportRequest,GenerateInsightsFinderReportResponse> generateInsightsFinderReportCallable()
      Creates a saved report that can be viewed in the Insights Finder tool.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         GenerateInsightsFinderReportRequest request =
             GenerateInsightsFinderReportRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setBaselineAudience(BasicInsightsAudience.newBuilder().build())
                 .setSpecificAudience(BasicInsightsAudience.newBuilder().build())
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .build();
         ApiFuture<GenerateInsightsFinderReportResponse> future =
             audienceInsightsServiceClient.generateInsightsFinderReportCallable().futureCall(request);
         // Do something.
         GenerateInsightsFinderReportResponse response = future.get();
       }
       
    • listAudienceInsightsAttributes

      public final ListAudienceInsightsAttributesResponse listAudienceInsightsAttributes(String customerId, List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions, String queryText)
      Searches for audience attributes that can be used to generate insights.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         String customerId = "customerId-1581184615";
         List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions = new ArrayList<>();
         String queryText = "queryText-1806881259";
         ListAudienceInsightsAttributesResponse response =
             audienceInsightsServiceClient.listAudienceInsightsAttributes(
                 customerId, dimensions, queryText);
       }
       
      Parameters:
      customerId - Required. The ID of the customer.
      dimensions - Required. The types of attributes to be returned. Supported dimensions are CATEGORY, KNOWLEDGE_GRAPH, GEO_TARGET_COUNTRY, SUB_COUNTRY_LOCATION, YOUTUBE_DYNAMIC_LINEUP, AFFINITY_USER_INTEREST, IN_MARKET_USER_INTEREST, PARENTAL_STATUS, INCOME_RANGE, AGE_RANGE, and GENDER.
      queryText - Required. A free text query. If the requested dimensions include Attributes CATEGORY or KNOWLEDGE_GRAPH, then the attributes returned for those dimensions will match or be related to this string. For other dimensions, this field is ignored and all available attributes are returned.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listAudienceInsightsAttributes

      public final ListAudienceInsightsAttributesResponse listAudienceInsightsAttributes(ListAudienceInsightsAttributesRequest request)
      Searches for audience attributes that can be used to generate insights.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         ListAudienceInsightsAttributesRequest request =
             ListAudienceInsightsAttributesRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .addAllDimensions(
                     new ArrayList<AudienceInsightsDimensionEnum.AudienceInsightsDimension>())
                 .setQueryText("queryText-1806881259")
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .addAllLocationCountryFilters(new ArrayList<LocationInfo>())
                 .setYoutubeReachLocation(LocationInfo.newBuilder().build())
                 .build();
         ListAudienceInsightsAttributesResponse response =
             audienceInsightsServiceClient.listAudienceInsightsAttributes(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listAudienceInsightsAttributesCallable

      public final com.google.api.gax.rpc.UnaryCallable<ListAudienceInsightsAttributesRequest,ListAudienceInsightsAttributesResponse> listAudienceInsightsAttributesCallable()
      Searches for audience attributes that can be used to generate insights.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         ListAudienceInsightsAttributesRequest request =
             ListAudienceInsightsAttributesRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .addAllDimensions(
                     new ArrayList<AudienceInsightsDimensionEnum.AudienceInsightsDimension>())
                 .setQueryText("queryText-1806881259")
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .addAllLocationCountryFilters(new ArrayList<LocationInfo>())
                 .setYoutubeReachLocation(LocationInfo.newBuilder().build())
                 .build();
         ApiFuture<ListAudienceInsightsAttributesResponse> future =
             audienceInsightsServiceClient
                 .listAudienceInsightsAttributesCallable()
                 .futureCall(request);
         // Do something.
         ListAudienceInsightsAttributesResponse response = future.get();
       }
       
    • listInsightsEligibleDates

      public final ListInsightsEligibleDatesResponse listInsightsEligibleDates(ListInsightsEligibleDatesRequest request)
      Lists date ranges for which audience insights data can be requested.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         ListInsightsEligibleDatesRequest request =
             ListInsightsEligibleDatesRequest.newBuilder().build();
         ListInsightsEligibleDatesResponse response =
             audienceInsightsServiceClient.listInsightsEligibleDates(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listInsightsEligibleDatesCallable

      public final com.google.api.gax.rpc.UnaryCallable<ListInsightsEligibleDatesRequest,ListInsightsEligibleDatesResponse> listInsightsEligibleDatesCallable()
      Lists date ranges for which audience insights data can be requested.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         ListInsightsEligibleDatesRequest request =
             ListInsightsEligibleDatesRequest.newBuilder().build();
         ApiFuture<ListInsightsEligibleDatesResponse> future =
             audienceInsightsServiceClient.listInsightsEligibleDatesCallable().futureCall(request);
         // Do something.
         ListInsightsEligibleDatesResponse response = future.get();
       }
       
    • generateAudienceCompositionInsights

      public final GenerateAudienceCompositionInsightsResponse generateAudienceCompositionInsights(String customerId, InsightsAudience audience, List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions)
      Returns a collection of attributes that are represented in an audience of interest, with metrics that compare each attribute's share of the audience with its share of a baseline audience.

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         String customerId = "customerId-1581184615";
         InsightsAudience audience = InsightsAudience.newBuilder().build();
         List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions = new ArrayList<>();
         GenerateAudienceCompositionInsightsResponse response =
             audienceInsightsServiceClient.generateAudienceCompositionInsights(
                 customerId, audience, dimensions);
       }
       
      Parameters:
      customerId - Required. The ID of the customer.
      audience - Required. The audience of interest for which insights are being requested.
      dimensions - Required. The audience dimensions for which composition insights should be returned. Supported dimensions are KNOWLEDGE_GRAPH, GEO_TARGET_COUNTRY, SUB_COUNTRY_LOCATION, YOUTUBE_CHANNEL, YOUTUBE_DYNAMIC_LINEUP, AFFINITY_USER_INTEREST, IN_MARKET_USER_INTEREST, PARENTAL_STATUS, INCOME_RANGE, AGE_RANGE, and GENDER.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • generateAudienceCompositionInsights

      public final GenerateAudienceCompositionInsightsResponse generateAudienceCompositionInsights(GenerateAudienceCompositionInsightsRequest request)
      Returns a collection of attributes that are represented in an audience of interest, with metrics that compare each attribute's share of the audience with its share of a baseline audience.

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         GenerateAudienceCompositionInsightsRequest request =
             GenerateAudienceCompositionInsightsRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setAudience(InsightsAudience.newBuilder().build())
                 .setBaselineAudience(InsightsAudience.newBuilder().build())
                 .setDataMonth("dataMonth-380142346")
                 .addAllDimensions(
                     new ArrayList<AudienceInsightsDimensionEnum.AudienceInsightsDimension>())
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .build();
         GenerateAudienceCompositionInsightsResponse response =
             audienceInsightsServiceClient.generateAudienceCompositionInsights(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • generateAudienceCompositionInsightsCallable

      public final com.google.api.gax.rpc.UnaryCallable<GenerateAudienceCompositionInsightsRequest,GenerateAudienceCompositionInsightsResponse> generateAudienceCompositionInsightsCallable()
      Returns a collection of attributes that are represented in an audience of interest, with metrics that compare each attribute's share of the audience with its share of a baseline audience.

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         GenerateAudienceCompositionInsightsRequest request =
             GenerateAudienceCompositionInsightsRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setAudience(InsightsAudience.newBuilder().build())
                 .setBaselineAudience(InsightsAudience.newBuilder().build())
                 .setDataMonth("dataMonth-380142346")
                 .addAllDimensions(
                     new ArrayList<AudienceInsightsDimensionEnum.AudienceInsightsDimension>())
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .build();
         ApiFuture<GenerateAudienceCompositionInsightsResponse> future =
             audienceInsightsServiceClient
                 .generateAudienceCompositionInsightsCallable()
                 .futureCall(request);
         // Do something.
         GenerateAudienceCompositionInsightsResponse response = future.get();
       }
       
    • generateSuggestedTargetingInsights

      public final GenerateSuggestedTargetingInsightsResponse generateSuggestedTargetingInsights(GenerateSuggestedTargetingInsightsRequest request)
      Returns a collection of targeting insights (e.g. targetable audiences) that are relevant to the requested audience.

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         GenerateSuggestedTargetingInsightsRequest request =
             GenerateSuggestedTargetingInsightsRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .build();
         GenerateSuggestedTargetingInsightsResponse response =
             audienceInsightsServiceClient.generateSuggestedTargetingInsights(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • generateSuggestedTargetingInsightsCallable

      public final com.google.api.gax.rpc.UnaryCallable<GenerateSuggestedTargetingInsightsRequest,GenerateSuggestedTargetingInsightsResponse> generateSuggestedTargetingInsightsCallable()
      Returns a collection of targeting insights (e.g. targetable audiences) that are relevant to the requested audience.

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         GenerateSuggestedTargetingInsightsRequest request =
             GenerateSuggestedTargetingInsightsRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .build();
         ApiFuture<GenerateSuggestedTargetingInsightsResponse> future =
             audienceInsightsServiceClient
                 .generateSuggestedTargetingInsightsCallable()
                 .futureCall(request);
         // Do something.
         GenerateSuggestedTargetingInsightsResponse response = future.get();
       }
       
    • generateAudienceOverlapInsights

      public final GenerateAudienceOverlapInsightsResponse generateAudienceOverlapInsights(String customerId, LocationInfo countryLocation, AudienceInsightsAttribute primaryAttribute, List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions)
      Returns a collection of audience attributes along with estimates of the overlap between their potential YouTube reach and that of a given input attribute.

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         String customerId = "customerId-1581184615";
         LocationInfo countryLocation = LocationInfo.newBuilder().build();
         AudienceInsightsAttribute primaryAttribute = AudienceInsightsAttribute.newBuilder().build();
         List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions = new ArrayList<>();
         GenerateAudienceOverlapInsightsResponse response =
             audienceInsightsServiceClient.generateAudienceOverlapInsights(
                 customerId, countryLocation, primaryAttribute, dimensions);
       }
       
      Parameters:
      customerId - Required. The ID of the customer.
      countryLocation - Required. The country in which to calculate the sizes and overlaps of audiences.
      primaryAttribute - Required. The audience attribute that should be intersected with all other eligible audiences. This must be an Affinity or In-Market UserInterest, an AgeRange or a Gender.
      dimensions - Required. The types of attributes of which to calculate the overlap with the primary_attribute. The values must be a subset of AFFINITY_USER_INTEREST, IN_MARKET_USER_INTEREST, AGE_RANGE and GENDER.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • generateAudienceOverlapInsights

      public final GenerateAudienceOverlapInsightsResponse generateAudienceOverlapInsights(GenerateAudienceOverlapInsightsRequest request)
      Returns a collection of audience attributes along with estimates of the overlap between their potential YouTube reach and that of a given input attribute.

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         GenerateAudienceOverlapInsightsRequest request =
             GenerateAudienceOverlapInsightsRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setCountryLocation(LocationInfo.newBuilder().build())
                 .setPrimaryAttribute(AudienceInsightsAttribute.newBuilder().build())
                 .addAllDimensions(
                     new ArrayList<AudienceInsightsDimensionEnum.AudienceInsightsDimension>())
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .build();
         GenerateAudienceOverlapInsightsResponse response =
             audienceInsightsServiceClient.generateAudienceOverlapInsights(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • generateAudienceOverlapInsightsCallable

      public final com.google.api.gax.rpc.UnaryCallable<GenerateAudienceOverlapInsightsRequest,GenerateAudienceOverlapInsightsResponse> generateAudienceOverlapInsightsCallable()
      Returns a collection of audience attributes along with estimates of the overlap between their potential YouTube reach and that of a given input attribute.

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         GenerateAudienceOverlapInsightsRequest request =
             GenerateAudienceOverlapInsightsRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setCountryLocation(LocationInfo.newBuilder().build())
                 .setPrimaryAttribute(AudienceInsightsAttribute.newBuilder().build())
                 .addAllDimensions(
                     new ArrayList<AudienceInsightsDimensionEnum.AudienceInsightsDimension>())
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .build();
         ApiFuture<GenerateAudienceOverlapInsightsResponse> future =
             audienceInsightsServiceClient
                 .generateAudienceOverlapInsightsCallable()
                 .futureCall(request);
         // Do something.
         GenerateAudienceOverlapInsightsResponse response = future.get();
       }
       
    • generateTargetingSuggestionMetrics

      public final GenerateTargetingSuggestionMetricsResponse generateTargetingSuggestionMetrics(String customerId, List<BasicInsightsAudience> audiences)
      Returns potential reach metrics for targetable audiences.

      This method helps answer questions like "How many Men aged 18+ interested in Camping can be reached on YouTube?"

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         String customerId = "customerId-1581184615";
         List<BasicInsightsAudience> audiences = new ArrayList<>();
         GenerateTargetingSuggestionMetricsResponse response =
             audienceInsightsServiceClient.generateTargetingSuggestionMetrics(customerId, audiences);
       }
       
      Parameters:
      customerId - Required. The ID of the customer.
      audiences - Required. Audiences to request metrics for.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • generateTargetingSuggestionMetrics

      public final GenerateTargetingSuggestionMetricsResponse generateTargetingSuggestionMetrics(GenerateTargetingSuggestionMetricsRequest request)
      Returns potential reach metrics for targetable audiences.

      This method helps answer questions like "How many Men aged 18+ interested in Camping can be reached on YouTube?"

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         GenerateTargetingSuggestionMetricsRequest request =
             GenerateTargetingSuggestionMetricsRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .addAllAudiences(new ArrayList<BasicInsightsAudience>())
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .build();
         GenerateTargetingSuggestionMetricsResponse response =
             audienceInsightsServiceClient.generateTargetingSuggestionMetrics(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • generateTargetingSuggestionMetricsCallable

      public final com.google.api.gax.rpc.UnaryCallable<GenerateTargetingSuggestionMetricsRequest,GenerateTargetingSuggestionMetricsResponse> generateTargetingSuggestionMetricsCallable()
      Returns potential reach metrics for targetable audiences.

      This method helps answer questions like "How many Men aged 18+ interested in Camping can be reached on YouTube?"

      List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AudienceInsightsServiceClient audienceInsightsServiceClient =
           AudienceInsightsServiceClient.create()) {
         GenerateTargetingSuggestionMetricsRequest request =
             GenerateTargetingSuggestionMetricsRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .addAllAudiences(new ArrayList<BasicInsightsAudience>())
                 .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                 .build();
         ApiFuture<GenerateTargetingSuggestionMetricsResponse> future =
             audienceInsightsServiceClient
                 .generateTargetingSuggestionMetricsCallable()
                 .futureCall(request);
         // Do something.
         GenerateTargetingSuggestionMetricsResponse response = future.get();
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface com.google.api.gax.core.BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface com.google.api.gax.core.BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface com.google.api.gax.core.BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface com.google.api.gax.core.BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface com.google.api.gax.core.BackgroundResource
      Throws:
      InterruptedException