Ads API - get number of purchse

169 views
Skip to first unread message

Prabhu Palanisamy

unread,
Nov 16, 2023, 7:38:49 AM11/16/23
to Google Ads API and AdWords API Forum
I tried to fetch the number of purchases from the ad account through the API, but it gives 0 value for all the campaign/ ad_group / customer levels. 

I tried the following metrics: 

metrics.orders
metrics.cross_sell_units_sold
metrics.units_sold

Query:
SELECT
            campaign.name,
            metrics.units_sold,
            metrics.orders,
            metrics.cross_sell_units_sold,
            FROM campaign WHERE
segments.date >= '2023-11-01' AND segments.date <= '2023-11-15'

Kindly advise how to get the value from the API. Screenshot attached.




Campaigns-Digital-Azadi-Ads-Account-Google-Ads.png

Google Ads API Forum Advisor

unread,
Nov 16, 2023, 2:31:32 PM11/16/23
to bytp...@gmail.com, adwor...@googlegroups.com
Hi,

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

By reviewing your query, I understand that you are trying to fetch the number of purchases through the API. 

In order to investigate your issue, kindly provide us with the uncropped UI screenshot of the Google Ads account with visible customer-id and complete API logs (request and response with request-id and request header) generated at your end.

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.

 
This message is in relation to case "ref:!00D1U01174p.!5004Q02qCgAo:ref"

Thanks,
 
Google Logo Google Ads API Team


Prabhu Palanisamy

unread,
Nov 22, 2023, 2:53:57 AM11/22/23
to Google Ads API and AdWords API Forum
Thank you! I can able to retrieve the purchase data now.

Query: select 
metrics.all_conversions_value, 
segments.conversion_action_category, 
metrics.all_conversions, 
from customer WHERE segments.date >= '2023-11-01' AND segments.date <= '2023-11-06' AND segments.conversion_action_category = 'PURCHASE'

here, all_conversions gives the total number of purchases.

Prabhu Palanisamy

unread,
Nov 22, 2023, 2:54:00 AM11/22/23
to Google Ads API and AdWords API Forum
Hi,

The solution you provided (below query) gives the category ID (conversion category ID) and the purchase value. However, my requirement is to retrieve the number of purchases from the ads API. I have highlighted the purchase column in the screenshot.
Query:
SELECT 
metrics.conversions_value, 
segments.conversion_action_category 
FROM campaign 
WHERE segments.date BETWEEN 'DATE' AND 'DATE' AND segments.conversion_action_category = 'PURCHASE'

Kindly advise. I have been waiting for too long.

On Friday, November 17, 2023 at 1:01:32 AM UTC+5:30 Google Ads API Forum Advisor wrote:
Campaigns-Digital-Azadi-Ads-Account-Google-Ads (1).png

Google Ads API Forum Advisor

unread,
Nov 22, 2023, 10:35:59 AM11/22/23
to bytp...@gmail.com, adwor...@googlegroups.com
Hi Prabhu,

Thank you for getting back to us.

By reviewing your concern, I understand that you want to retrieve the number of purchases from the campaign resource via Google Ads API. Please note that the number of purchases data from the campaign resource is not yet supported in the Google Ads API. 

I will raise a request to add this feature to be available in the Google Ads API. We cannot provide a scheduled timeline for the availability of this feature in the Google Ads API. I would recommend you please follow our Release Notes and Blog Post for future updates.
Reply all
Reply to author
Forward
0 new messages