use of com.google.api.ads.adwords.axis.v201809.cm.OfflineCallConversionFeedReturnValue in project googleads-java-lib by googleads.
the class UploadOfflineCallConversions method runExample.
/**
* Runs the example.
*
* @param adWordsServices the services factory.
* @param session the session.
* @param callerId the caller ID of the call.
* @param callStartTime the call start time of the call.
* @param conversionName the name of the conversion tracker.
* @param conversionTime the date and time of the conversion.
* @param conversionValue the value of the conversion.
* @throws ApiException if the API request failed with one or more service errors.
* @throws RemoteException if the API request failed due to other errors.
*/
public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session, String callerId, String callStartTime, String conversionName, String conversionTime, double conversionValue) throws RemoteException {
// Get the OfflineCallConversionFeedService.
OfflineCallConversionFeedServiceInterface offlineCallConversionFeedService = adWordsServices.get(session, OfflineCallConversionFeedServiceInterface.class);
// Associate offline call conversions with the existing named conversion tracker. If this
// tracker was newly created, it may be a few hours before it can accept conversions.
OfflineCallConversionFeed feed = new OfflineCallConversionFeed();
feed.setCallerId(callerId);
feed.setCallStartTime(callStartTime);
feed.setConversionName(conversionName);
feed.setConversionTime(conversionTime);
feed.setConversionValue(conversionValue);
OfflineCallConversionFeedOperation offlineCallConversionOperation = new OfflineCallConversionFeedOperation();
offlineCallConversionOperation.setOperator(Operator.ADD);
offlineCallConversionOperation.setOperand(feed);
// This example uploads only one call conversion, but you can upload multiple call conversions
// by passing additional operations.
OfflineCallConversionFeedReturnValue offlineCallConversionReturnValue = offlineCallConversionFeedService.mutate(new OfflineCallConversionFeedOperation[] { offlineCallConversionOperation });
// Display results.
for (OfflineCallConversionFeed feedResult : offlineCallConversionReturnValue.getValue()) {
System.out.printf("Uploaded offline conversion value of %.4f for caller ID '%s'.%n", feedResult.getConversionValue(), feedResult.getCallerId());
}
}
Aggregations