Getting statistics for the leadForm

177 views
Skip to first unread message

Anna Lysak

unread,
Sep 16, 2022, 8:59:40 AM9/16/22
to Google Ads API and AdWords API Forum
Hi Team,

Could you please help me with query to get statistics for Lead form extension:
I know the campaign ID, ad Group ID and Item ID (which is Lead Form Asset ID).

I checked https://developers.google.com/google-ads/api/docs/query/cookbook, but there are no example for lead form extension.

extension_feed_item doesn't help as there are even no type LEAD_FORM.
Could you please help me, I need to get metrics for Lead Form extension by Item ID (Lead Form Id).
it should be something like for campaigns (i need metrics) https://developers.google.com/google-ads/api/docs/query/cookbook#api_query , but ID should be Lead Form ID

Thanks in advance.

Anna Lysak

unread,
Sep 16, 2022, 9:50:21 AM9/16/22
to Google Ads API and AdWords API Forum
I also tried:
{
"query": "SELECT asset.id, asset.name, asset.type, campaign.id, metrics.ctr FROM campaign_asset WHERE segments.date='2022-09-16' and asset.type='LEAD_FORM' and asset.id=<lead form id> and campaign.id=<campaign ID>"
}
"
if I add metrics.ctr (or other metrics fields) to SELECT - I get empty result: 
Data {
    "fieldMask": "asset.id,asset.name,asset.type,campaign.id,metrics.ctr"
}



If I remove metrics.ctr (actually any metrics field) I receive result:
{
    "results": [
        {
            "campaign": {
                "resourceName": "customers/XXXX/campaigns/XXXX",
                "id": "XXX"
            },
            "asset": {
                "resourceName": "customers/XXX/assets/XXXX",
                "type": "LEAD_FORM",
                "id": "XXXXX",
                "name": "My Lead Form #12345"
            },
            "campaignAsset": {
                "resourceName": "customers/XXXXX/campaignAssets/XXXX~XXXX~LEAD_FORM"
            }
        }
    ],
    "fieldMask": "asset.id,asset.name,asset.type,campaign.id"
}

Could you please help me ? How can I receive at least zeros for metrics? They are available(zeros) if querying 'FROM campaign'. 
Thanks!

Google Ads API Forum Advisor

unread,
Sep 16, 2022, 10:56:25 AM9/16/22
to gann...@gmail.com, adwor...@googlegroups.com

Hi Anna,

Thank you for reaching out to us.

For our team to further investigate and provide appropriate recommendations, could you please provide us with the complete API logs(request and response with request-id) generated on your end and whole Google Ads UI screenshot where you can see the data you want to retrieve in the API?

Moving forward to this, “How can I receive at least zeros for metrics? They are available(zeros) if querying 'FROM campaign
-Please note that it is currently not possible to force return a row if all selected metrics fields are zero. However, if there's one or more selected metrics fields having a value that is not zero, the row should be returned. You can refer to this documentation for more details.

And for this, “They are available(zeros) if querying 'FROM campaign
-Could you also provide us the complete API logs(request and response with request-id ) generated on your end seeing the available(zeros) if querying 'FROM campaign?

You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Best regards,

Google Logo
Heidi
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ePL6o:ref

Anna Lysak

unread,
Sep 16, 2022, 11:55:02 AM9/16/22
to Google Ads API and AdWords API Forum
Hi Heidi,
Thanks for reply.
May answers: 
1) Querying campaign:
url = 'https://googleads.googleapis.com/v11/customers/XXXXX/googleAds:search'
params = {
"query": "SELECT campaign.id, campaign.name, campaign.status, metrics.gmail_saves FROM campaign WHERE campaign.id=XXX and segments.date='2022-09-16'"
}
and response:
{
    "results": [
        {
            "campaign": {
                "resourceName": "customers/XXX/campaigns/XXX",
                "status": "ENABLED",
                "name": "Leads-Search-1",
                "id": "XXX"
            },
            "metrics": {
                "gmailSaves": "0"
            }
        }
    ],
    "fieldMask": "campaign.id,campaign.name,campaign.status,metrics.gmailSaves"
}
headers <CIMultiDictProxy('Request-Id': 'n21hVpOMk3tokttJREjZzw', ...)> 

2) Querying campaign_asset:
url = 'https://googleads.googleapis.com/v11/customers/XXXX/googleAds:search'
params = {
"query": "SELECT asset.id, asset.name, asset.type, campaign.id, metrics.clicks FROM campaign_asset WHERE segments.date='2022-09-16' and asset.type='LEAD_FORM' and asset.id=XXXXX and campaign.id=XXXX"
}
and response:
 {
    "fieldMask": "asset.id,asset.name,asset.type,campaign.id,metrics.clicks"
}
headers <CIMultiDictProxy('Request-Id': 'McxEY-4JurabYL99z7R9bg' ...)>

Thanks in advance!

Google Ads API Forum Advisor

unread,
Sep 16, 2022, 2:03:31 PM9/16/22
to gann...@gmail.com, adwor...@googlegroups.com
Hi Anna,

Thank you for sending more details. I work with Heidi and allow me to assist you here.

Upon checking the provided logs, I am afraid that this is not enough to further investigate the issue. It would be helpful if you can provide the complete API logs within the format of request and response logs with the request-id and request header that generated on your end also  whole Google Ads UI screenshot where you can see the data you want to retrieve in the API?

 "And for this, “They are available(zeros) if querying 'FROM campaign
-Could you also provide us the complete API logs(request and response with request-id ) generated on your end seeing the available(zeros) if querying 'FROM campaign?" that was mentioned by my colleague. 

That said, please provide the information without reducting part as this information will help our team to better check. If you haven't yet, logging can be enabled by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link.

For privacy purposes, you can provide it via the Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Best regards,
Google Logo
Jinky
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ePL6o:ref

Anna Lysak

unread,
Sep 22, 2022, 7:34:53 AM9/22/22
to Google Ads API and AdWords API Forum
Hi Jinky,

Is there possibility to get statistics metrics by date? Like
 """
SELECT asset.id,
asset.name,
asset.type,
metrics.ctr,
metrics.average_cpc,
metrics.impressions,
metrics.clicks,
metrics.interactions,
metrics.interaction_rate,
metrics.average_cost,
metrics.phone_through_rate,
metrics.phone_calls,
metrics.phone_impressions,
metrics.conversions,
metrics.cost_per_conversion,
metrics.all_conversions,
metrics.value_per_all_conversions,
metrics.cross_device_conversions,
metrics.all_conversions_value,
metrics.cost_per_all_conversions,
metrics.conversions_value,
segments.date
FROM campaign_asset
WHERE segments.date > '2022-09-10' and segments.date < '2022-09-20'
AND asset.id=XXXXX AND asset.type='LEAD_FORM'
"""

This query doesn't return metrics data, it only returns 
Data {
    "fieldMask": "asset.id,asset.name,asset.type,metrics.ctr,metrics.averageCpc,metrics.impressions,metrics.clicks,metrics.interactions,metrics.interactionRate,metrics.averageCost,metrics.phoneThroughRate,metrics.phoneCalls,metrics.phoneImpressions,metrics.conversions,metrics.costPerConversion,metrics.allConversions,metrics.valuePerAllConversions,metrics.crossDeviceConversions,metrics.allConversionsValue,metrics.costPerAllConversions,metrics.conversionsValue,segments.date"
}
headers <CIMultiDictProxy('Request-Id': 'JCk2SXc5r0BIG1yLLQtFAA',

Thanks in advance!
Anna.

Google Ads API Forum Advisor

unread,
Sep 22, 2022, 10:25:59 AM9/22/22
to gann...@gmail.com, adwor...@googlegroups.com

Hi Anna,

Thank you for raising this concern to the Google Ads API support team.

Could you please confirm if you are still querying the report in this 6074981807? If yes, then I am afraid that you will not be able to generate reports with the current query because it encountered this behavior. Please note that zero metrics rows are always excluded when segmenting a report, provided all selected metrics are zero.

The workaround here is to remove the segment field in the report and generate a separate report for each date.

Best regards,

Anna Lysak

unread,
Sep 22, 2022, 10:54:51 AM9/22/22
to Google Ads API and AdWords API Forum
Thank you very much for the reply, it's clear now
Reply all
Reply to author
Forward
0 new messages