Class AudienceInsightsServiceClient
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,AutoCloseable
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().
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of AudienceInsightsServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final AudienceInsightsServiceClientcreate()Constructs an instance of AudienceInsightsServiceClient with default settings.static final AudienceInsightsServiceClientcreate(AudienceInsightsServiceSettings settings) Constructs an instance of AudienceInsightsServiceClient, using the given settings.static final AudienceInsightsServiceClientConstructs an instance of AudienceInsightsServiceClient, using the given stub for making calls.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.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.final com.google.api.gax.rpc.UnaryCallable<GenerateAudienceCompositionInsightsRequest,GenerateAudienceCompositionInsightsResponse> 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.Returns a collection of audience attributes along with estimates of the overlap between their potential YouTube reach and that of a given input attribute.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.final com.google.api.gax.rpc.UnaryCallable<GenerateAudienceOverlapInsightsRequest,GenerateAudienceOverlapInsightsResponse> Returns a collection of audience attributes along with estimates of the overlap between their potential YouTube reach and that of a given input attribute.Creates a saved report that can be viewed in the Insights Finder tool.generateInsightsFinderReport(String customerId, BasicInsightsAudience baselineAudience, BasicInsightsAudience specificAudience) Creates a saved report that can be viewed in the Insights Finder tool.final com.google.api.gax.rpc.UnaryCallable<GenerateInsightsFinderReportRequest,GenerateInsightsFinderReportResponse> Creates a saved report that can be viewed in the Insights Finder tool.Returns a collection of targeting insights (e.g.final com.google.api.gax.rpc.UnaryCallable<GenerateSuggestedTargetingInsightsRequest,GenerateSuggestedTargetingInsightsResponse> Returns a collection of targeting insights (e.g.Returns potential reach metrics for targetable audiences.generateTargetingSuggestionMetrics(String customerId, List<BasicInsightsAudience> audiences) Returns potential reach metrics for targetable audiences.final com.google.api.gax.rpc.UnaryCallable<GenerateTargetingSuggestionMetricsRequest,GenerateTargetingSuggestionMetricsResponse> Returns potential reach metrics for targetable audiences.getStub()booleanbooleanSearches for audience attributes that can be used to generate insights.listAudienceInsightsAttributes(String customerId, List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions, String queryText) Searches for audience attributes that can be used to generate insights.final com.google.api.gax.rpc.UnaryCallable<ListAudienceInsightsAttributesRequest,ListAudienceInsightsAttributesResponse> Searches for audience attributes that can be used to generate insights.Lists date ranges for which audience insights data can be requested.final com.google.api.gax.rpc.UnaryCallable<ListInsightsEligibleDatesRequest,ListInsightsEligibleDatesResponse> Lists date ranges for which audience insights data can be requested.voidshutdown()void
-
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
-
-
Method Details
-
create
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
-
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:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
InterruptedException
-