Demand Gen Campaign Creation with "Clicks" Goal in PHP - Getting API Error

23 views
Skip to first unread message

Ashish Chaturvedi (Ashu)

unread,
Aug 18, 2025, 12:41:14 PMAug 18
to Google Ads API and AdWords API Forum

Hello Google Ads Community,

I am trying to create a Demand Gen campaign using the PHP client library (version 19). My goal is to set the campaign objective to "Clicks" as it appears in the Google Ads UI.

Screenshot 2025-08-18 at 9.51.12 PM.png
However, I'm facing an API error that I can't resolve. I initially tried using maximize_clicks, but that resulted in a No such field maximize_clicks error, even with the latest library. After trying a different approach, the issue persists.

Here is my code snippet for creating the campaign. I've noted that I am currently using maximize_conversions as a test, but my true goal is "Clicks".

try {
    // Creates a single shared budget to be used by the campaigns added below.
    $budgetResourceName = $this->addCampaignBudget($customerId, $params);
    $budgetResourceName = json_decode($budgetResourceName->getContent(),true);

    // Build network settings
    $networkSettings = new NetworkSettings([
        'target_google_search' => true,
        'target_search_network' => true,
        'target_content_network' => true,
        'target_partner_search_network' => false
    ]);
    $name = $params['name'];

    // Prepare your campaign parameters
    $campaignData = [
        'name' => $name,
        'advertising_channel_type' => AdvertisingChannelType::DEMAND_GEN,
        'campaign_budget' => $budgetResourceName['response'],
        'network_settings' => $networkSettings,
        'maximize_conversions' => new MaximizeConversions(), // This is a placeholder; I need 'Clicks'
        'status' => CampaignStatus::PAUSED
    ];

    if (!empty($params['start_date'])) {
        $campaignData['start_date'] = $params['start_date'];
    }

    if (!empty($params['end_date'])) {
        $campaignData['end_date'] = $params['end_date'];
    }

    $campaign = new Campaign($campaignData);

    // ... (rest of the code to mutate the campaign)

} catch (GoogleAdsException $ex) {
    // ... (error handling)
}

My core issue is: What is the correct way to set the bidding strategy for a "Clicks" goal on a Demand Gen campaign using the PHP client library?

Any guidance or a working code example would be greatly appreciated.

Thank you!

Google Ads API Forum Advisor

unread,
Aug 18, 2025, 5:52:07 PMAug 18
to ashish007...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

From the provided image, the clicks uses the cpc bid strategy. I would recommend that you set the bidstrategy to manual_cpc. Kindly refer to this code example. Also, to assist your further with the code, could you please provide us with the complete API logs (request and response logs with request-id and request header) generated at your end. This would help us understand the issue and assist you accordingly.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-08-18 21:51:14Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01szPi2:ref" (ADR-00330269)



Google Ads API Forum Advisor

unread,
Aug 18, 2025, 5:53:22 PMAug 18
to ashish007...@gmail.com, adwor...@googlegroups.com
Hi,

Kindly disregard my previous email. Thank you for reaching out to the Google Ads API support team.


From the provided image, the clicks uses the cpc bid strategy. I would recommend that you set the bidstrategy to manual_cpc. Kindly refer to this code example. Also, to assist your further with the code, could you please provide us with the complete API logs (request and response logs with request-id and request header) generated at your end. This would help us understand the issue and assist you accordingly.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-08-18 21:52:40Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01szPi2:ref" (ADR-00330269)



Reply all
Reply to author
Forward
0 new messages