Campaign Conversion Goal Service

82 views
Skip to first unread message

Tài Ngô

unread,
Dec 13, 2021, 5:54:50 AM12/13/21
to AdWords API and Google Ads API Forum
Hi! 

I'm trying to add conversion goal to a campaign using this service.

The operation requires Resource Name with the form: customers/{customer_id}/campaignConversionGoals/{campaign_id}~{category}~{origin}

Is there any way to add conversion goal to a campaign only with conversion's id? 

Currenly, we have to query the detail of conversion from id to get {category} and {origin} 

Google Ads API Forum Advisor

unread,
Dec 13, 2021, 3:29:45 PM12/13/21
to nagasi...@gmail.com, adwor...@googlegroups.com
Hi Tài,

To set as goal a specific conversion action when there are more than one that has the same category and origin you would set up a custom conversion goal. This won't stop the need to set to false every other combination of category and origin. Feel free to get back to us on what defaults make sense. If you have full screenshots of how it's done in the UI that show different ways to do this that are easier for you you can send them privately to us.

Regards,

Google Logo
Aryeh Baker
Google Ads API Team
 


ref:_00D1U1174p._5004Q2SeaZx:ref

Tài Ngô

unread,
Dec 13, 2021, 11:20:32 PM12/13/21
to AdWords API and Google Ads API Forum
Hi! 
Trying to create Custom Conversion but I got this error.

errors {
  error_code {
    request_error: UNKNOWN
  }
  message: "The error code is not in this version."
  location {
    field_path_elements {
      field_name: "operations"
      index: 0
    }
  }
}
request_id: "31N9CDU3Y4IZMiAHAJE23w"

Here is my code: 

public Map<String, Object> createCustomConversion(Long customerId, String conversionId) {
CustomConversionGoal customConversionGoal = CustomConversionGoal.newBuilder()
.setName("Custom Conversion Goal for campaign 1")
.setStatus(CustomConversionGoalStatusEnum.CustomConversionGoalStatus.ENABLED)
.addConversionActions(ResourceNames.conversionAction(customerId, Long.parseLong(conversionId)))
.build();

CustomConversionGoalOperation operation = CustomConversionGoalOperation.newBuilder()
.setCreate(customConversionGoal)
.build();

GoogleAdsClient client = sdkService.getGoogleAdsSDKClient(customerId);
try (CustomConversionGoalServiceClient serviceClient = client.getLatestVersion().createCustomConversionGoalServiceClient()) {
MutateCustomConversionGoalsRequest request = MutateCustomConversionGoalsRequest.newBuilder()
.setCustomerId(customerId.toString())
.addOperations(operation)
.setValidateOnly(false)
.build();
MutateCustomConversionGoalsResponse response = serviceClient.mutateCustomConversionGoals(request);
if (response.getResultsCount() == 0) {
return Utility.generateSuccessResponse();
}
return Utility.generateSuccessResponse();
} catch (GoogleAdsException e) {
BasicDBObject logParam = Utility.buildParam(customerId, customConversionGoal, false);
return Utility.generateErrorResponse(logParam, e);
} catch (Exception e) {
return Utility.generateErrorResponse(e);
}
}

Tài Ngô

unread,
Dec 14, 2021, 1:25:26 AM12/14/21
to AdWords API and Google Ads API Forum
I'm using v9 btw

Google Ads API Forum Advisor

unread,
Dec 14, 2021, 4:54:19 PM12/14/21
to nagasi...@gmail.com, adwor...@googlegroups.com
Hello Tai,

Thanks for getting back to us.I am Jakeia, part of the Google Ads API team.

To investigate the issue, could you please provide the complete request and response logs with request ID and request header generated on your end. Please use the Reply privately to the author option while sharing the details to ensure the details are securely shared.

Additionally, please refer to this documentation for more information on conversion custom variable fields.

Regards,

Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey
Best regards,
Google Logo
Jakeia Sabrina
Google Ads API Team
 


ref:_00D1U1174p._5004Q2SeaZx:ref
Reply all
Reply to author
Forward
0 new messages