use of com.google.api.ads.adwords.axis.v201809.cm.OfflineConversionFeedReturnValue in project googleads-java-lib by googleads.
the class UploadOfflineConversions method runExample.
/**
* Runs the example.
*
* @param adWordsServices the services factory.
* @param session the session.
* @param conversionName the name of the conversion tracker.
* @param gClid the GCLID for the conversion.
* @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 conversionName, String gClid, String conversionTime, double conversionValue) throws RemoteException {
// Get the OfflineConversionFeedService.
OfflineConversionFeedServiceInterface offlineConversionFeedService = adWordsServices.get(session, OfflineConversionFeedServiceInterface.class);
// Associate offline conversions with the existing named conversion tracker. If this tracker
// was newly created, it may be a few hours before it can accept conversions.
OfflineConversionFeed feed = new OfflineConversionFeed();
feed.setConversionName(conversionName);
feed.setConversionTime(conversionTime);
feed.setConversionValue(conversionValue);
feed.setGoogleClickId(gClid);
OfflineConversionFeedOperation offlineConversionOperation = new OfflineConversionFeedOperation();
offlineConversionOperation.setOperator(Operator.ADD);
offlineConversionOperation.setOperand(feed);
OfflineConversionFeedReturnValue offlineConversionReturnValue = offlineConversionFeedService.mutate(new OfflineConversionFeedOperation[] { offlineConversionOperation });
OfflineConversionFeed newFeed = offlineConversionReturnValue.getValue(0);
System.out.printf("Uploaded offline conversion value of %.4f for Google Click ID '%s' to '%s'.%n", newFeed.getConversionValue(), newFeed.getGoogleClickId(), newFeed.getConversionName());
}
Aggregations