Hello ,
i am using rest api for creating campaign ,i need set campaign conversion goals neither the generic nor the custom ,
const createConversionGoals = async (
customerId,
accessToken,
developerToken
) => {
const goals = {
campaign: "customers/3300782374/campaigns/21459121432",
category: "PURCHASE",
origin: "WEBSITE",
resourceName: "customers/3300782374/campaignConversionGoals/21459121432~PURCHASE~WEBSITE",
};
try {
const response = await
axios.post(
https://googleads.googleapis.com/v17/customers/${customerId}/campaignConversionGoals:mutate,
{
operations: [{ update: goals, updateMask: "origin, campaign, resourceName" }],
},
{
headers: {
Authorization: Bearer ${accessToken},
"developer-token": developerToken,
"login-customer-id": customerId,
"Content-Type": "application/json",
},
}
);
console.log("Response data:", response.data);
// const budgetResourceName = response.data.results[0].resource_name;
return response.data;
} catch (error) {
console.error("Error creating Conversion Goals:", error.response.data);
return error.response.data;
}
};
Please hlep me figure this out