}
public static void runExample(
AdWordsServices adWordsServices, AdWordsSession session) throws Exception {
// Get the ConversionTrackerService.
ConversionTrackerServiceInterface service =
adWordsServices.get(session, ConversionTrackerServiceInterface.class);
// Create AdWords conversion.
AdWordsConversionTracker adWordsConversionTracker = new AdWordsConversionTracker();
adWordsConversionTracker.setName("Earth to Mars Cruises Conversion # "
+ System.currentTimeMillis());
adWordsConversionTracker.setCategory(ConversionTrackerCategory.DEFAULT);
adWordsConversionTracker.setMarkupLanguage(AdWordsConversionTrackerMarkupLanguage.HTML);
adWordsConversionTracker.setTextFormat(AdWordsConversionTrackerTextFormat.HIDDEN);
// You can optionally provide these field(s).
adWordsConversionTracker.setStatus(ConversionTrackerStatus.ENABLED);
adWordsConversionTracker.setViewthroughLookbackWindow(15);
adWordsConversionTracker.setIsProductAdsChargeable(Boolean.TRUE);
adWordsConversionTracker.setProductAdsChargeableConversionWindow(15);
adWordsConversionTracker.setConversionPageLanguage("en");
adWordsConversionTracker.setBackgroundColor("#0000FF");
adWordsConversionTracker.setDefaultRevenueValue(1d);
adWordsConversionTracker.setAlwaysUseDefaultRevenueValue(Boolean.TRUE);
// Create operations.
ConversionTrackerOperation operation = new ConversionTrackerOperation();
operation.setOperator(Operator.ADD);
operation.setOperand(adWordsConversionTracker);
ConversionTrackerOperation[] operations = new ConversionTrackerOperation[] {operation};
// Add conversion.
ConversionTrackerReturnValue result = service.mutate(operations);
// Display conversion.
for (ConversionTracker conversionTracker : result.getValue()) {
if (conversionTracker instanceof AdWordsConversionTracker) {
AdWordsConversionTracker newAdWordsConversionTracker =