Skip to content

Commit

Permalink
Changes for intermediate release v8_0. (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
devchas authored Jul 7, 2021
1 parent 0f999cf commit 7a002e5
Show file tree
Hide file tree
Showing 4,047 changed files with 89 additions and 1,706,312 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
14.0.0 - 2021-07-07
-------------------
- Added and updated examples for Google Ads API v8.0.
- Removed support for Google Ads API v5.0.
- Moved generateThirdPartyDirectory execution out of configure phase (#444).
- Added sonatype publish for shadow jar (#445).
- Add required artifacts for central repo (#446).

13.0.0 - 2021-06-17
-------------------
- Added support and examples for Google Ads API v8.0.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ This project hosts the Java client library for the Google Ads API.
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>google-ads</artifactId>
<version>13.0.0</version>
<version>14.0.0</version>
</dependency>

## Gradle dependency

implementation 'com.google.api-ads:google-ads:13.0.0'
implementation 'com.google.api-ads:google-ads:14.0.0'

## Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ private void runExample(
+ " ad_group_bid_modifier.hotel_check_in_day.day_of_week,"
+ " ad_group_bid_modifier.preferred_content.type "
+ "FROM"
+ " ad_group_bid_modifier";
+ " ad_group_bid_modifier"
+ "LIMIT 10000";
if (adGroupId != null) {
searchQuery += String.format(" WHERE ad_group.id = %d", adGroupId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
import com.google.ads.googleads.v8.services.CallConversion;
import com.google.ads.googleads.v8.services.CallConversionResult;
import com.google.ads.googleads.v8.services.ConversionUploadServiceClient;
import com.google.ads.googleads.v8.services.CustomVariable;
import com.google.ads.googleads.v8.services.UploadCallConversionsRequest;
import com.google.ads.googleads.v8.services.UploadCallConversionsResponse;
import com.google.ads.googleads.v8.utils.ResourceNames;
import java.io.FileNotFoundException;
import java.io.IOException;

Expand Down Expand Up @@ -59,6 +61,14 @@ private static class UploadCallConversionParams extends CodeSampleParams {

@Parameter(names = ArgumentNames.CONVERSION_VALUE)
private double conversionValue;

// Optional: Specify the conversion custom variable ID and value you want to
// associate with the call conversion upload.
@Parameter(names = ArgumentNames.CONVERSION_CUSTOM_VARIABLE_ID)
private Long conversionCustomVariableId;

@Parameter(names = ArgumentNames.CONVERSION_CUSTOM_VARIABLE_VALUE)
private String conversionCustomVariableValue;
}

public static void main(String[] args) {
Expand All @@ -67,11 +77,15 @@ public static void main(String[] args) {
// Either pass the required parameters for this example on the command line, or insert them
// into the code here. See the parameter class definition above for descriptions.
params.customerId = Long.parseLong("INSERT_CUSTOMER_ID");
params.conversionActionId = "INSERT_CONVERSAION_ACTION_ID";
params.conversionActionId = "INSERT_CONVERSION_ACTION_ID";
params.callerId = "INSERT_CALLER_ID";
params.callStartDateTime = "INSERT_CALL_START_DATE_TIME";
params.conversionDateTime = "INSERT_CONVERSION_DATE_TIME";
params.conversionValue = Double.parseDouble("INSERT_CONVERSION_VALUE");
// Optionally specify the conversion custom variable ID and value you want to
// associate with the call conversion upload.
params.conversionCustomVariableId = null;
params.conversionCustomVariableValue = null;
}

GoogleAdsClient googleAdsClient = null;
Expand All @@ -94,7 +108,9 @@ public static void main(String[] args) {
params.conversionActionId,
params.callerId,
params.callStartDateTime,
params.conversionValue);
params.conversionValue,
params.conversionCustomVariableId,
params.conversionCustomVariableValue);
} catch (GoogleAdsException gae) {
// GoogleAdsException is the base class for most exceptions thrown by an API request.
// Instances of this exception have a message and a GoogleAdsFailure that contains a
Expand All @@ -120,6 +136,10 @@ public static void main(String[] args) {
* @param callerId the caller ID.
* @param callStartDateTime the call start date time
* @param conversionValue the value of the conversion in USD.
* @param conversionCustomVariableId the ID of the conversion custom variable to associate with
* the upload.
* @param conversionCustomVariableValue the value of the conversion custom variable to associate
* with the upload.
*/
// [START upload_call_conversion]
private void runExample(
Expand All @@ -128,16 +148,27 @@ private void runExample(
String conversionActionId,
String callerId,
String callStartDateTime,
double conversionValue) {
double conversionValue,
Long conversionCustomVariableId,
String conversionCustomVariableValue) {
// Create a call conversion by specifying currency as USD.
CallConversion conversion =
CallConversion.Builder conversionBuilder =
CallConversion.newBuilder()
.setConversionAction(conversionActionId)
.setCallerId(callerId)
.setCallStartDateTime(callStartDateTime)
.setConversionValue(conversionValue)
.setCurrencyCode("USD")
.build();
.setCurrencyCode("USD");

if (conversionCustomVariableId != null && conversionCustomVariableValue != null) {
conversionBuilder.addCustomVariables(
CustomVariable.newBuilder()
.setConversionCustomVariable(
ResourceNames.conversionCustomVariable(customerId, conversionCustomVariableId))
.setValue(conversionCustomVariableValue));
}

CallConversion conversion = conversionBuilder.build();

// Uploads the call conversion to the API.
try (ConversionUploadServiceClient conversionUploadServiceClient =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.ads.googleads.v8.services.ClickConversion;
import com.google.ads.googleads.v8.services.ClickConversionResult;
import com.google.ads.googleads.v8.services.ConversionUploadServiceClient;
import com.google.ads.googleads.v8.services.CustomVariable;
import com.google.ads.googleads.v8.services.UploadClickConversionsRequest;
import com.google.ads.googleads.v8.services.UploadClickConversionsResponse;
import com.google.ads.googleads.v8.utils.ResourceNames;
Expand Down Expand Up @@ -53,6 +54,14 @@ private static class UploadOfflineConversionParams extends CodeSampleParams {

@Parameter(names = ArgumentNames.CONVERSION_VALUE, required = true)
private Double conversionValue;

// Optional: Specify the conversion custom variable ID and value you want to
// associate with the call conversion upload.
@Parameter(names = ArgumentNames.CONVERSION_CUSTOM_VARIABLE_ID)
private Long conversionCustomVariableId;

@Parameter(names = ArgumentNames.CONVERSION_CUSTOM_VARIABLE_VALUE)
private String conversionCustomVariableValue;
}

public static void main(String[] args) {
Expand All @@ -66,6 +75,10 @@ public static void main(String[] args) {
params.gclid = "INSERT_GCL_ID_HERE";
params.conversionDateTime = "INSERT_CONVERSION_DATE_TIME_HERE";
params.conversionValue = Double.parseDouble("INSERT_CONVERSION_VALUE_HERE");
// Optionally specify the conversion custom variable ID and value you want to
// associate with the call conversion upload.
params.conversionCustomVariableId = null;
params.conversionCustomVariableValue = null;
}

GoogleAdsClient googleAdsClient = null;
Expand All @@ -88,7 +101,9 @@ public static void main(String[] args) {
params.conversionActionId,
params.gclid,
params.conversionDateTime,
params.conversionValue);
params.conversionValue,
params.conversionCustomVariableId,
params.conversionCustomVariableValue);
} catch (GoogleAdsException gae) {
// GoogleAdsException is the base class for most exceptions thrown by an API request.
// Instances of this exception have a message and a GoogleAdsFailure that contains a
Expand All @@ -114,6 +129,10 @@ public static void main(String[] args) {
* @param gclid the GCLID for the conversion.
* @param conversionDateTime date and time of the conversion.
* @param conversionValue the value of the conversion.
* @param conversionCustomVariableId the ID of the conversion custom variable to associate with
* the upload.
* @param conversionCustomVariableValue the value of the conversion custom variable to associate
* with the upload.
*/
// [START upload_offline_conversion]
private void runExample(
Expand All @@ -122,20 +141,31 @@ private void runExample(
long conversionActionId,
String gclid,
String conversionDateTime,
Double conversionValue) {
Double conversionValue,
Long conversionCustomVariableId,
String conversionCustomVariableValue) {
// Gets the conversion action resource name.
String conversionActionResourceName =
ResourceNames.conversionAction(customerId, conversionActionId);

// Creates the click conversion.
ClickConversion clickConversion =
ClickConversion.Builder clickConversionBuilder =
ClickConversion.newBuilder()
.setConversionAction(conversionActionResourceName)
.setConversionDateTime(conversionDateTime)
.setConversionValue(conversionValue)
.setCurrencyCode("USD")
.setGclid(gclid)
.build();
.setGclid(gclid);

if (conversionCustomVariableId != null && conversionCustomVariableValue != null) {
clickConversionBuilder.addCustomVariables(
CustomVariable.newBuilder()
.setConversionCustomVariable(
ResourceNames.conversionCustomVariable(customerId, conversionCustomVariableId))
.setValue(conversionCustomVariableValue));
}

ClickConversion clickConversion = clickConversionBuilder.build();

// Creates the conversion upload service client.
try (ConversionUploadServiceClient conversionUploadServiceClient =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public final class ArgumentNames {
public static final String CHAIN_ID = "--chainId";
public static final String CONVERSION_ACTION_ID = "--conversionActionId";
public static final String CONVERSION_ACTION_IDS = "--conversionActionIds";
public static final String CONVERSION_CUSTOM_VARIABLE_ID = "--conversionCustomVariableId";
public static final String CONVERSION_CUSTOM_VARIABLE_VALUE = "--conversionCustomVariableValue";
public static final String CONVERSION_DATE_TIME = "--conversionDateTime";
public static final String CONVERSION_VALUE = "--conversionValue";
public static final String COUNTRY_CODE = "--countryCode";
Expand Down

This file was deleted.

Loading

0 comments on commit 7a002e5

Please sign in to comment.