Sitelink search fails in Beta experience

97 views
Skip to first unread message

Petra Manos

unread,
Jun 8, 2022, 12:57:55 AM6/8/22
to Google Ads Scripts Forum
Hello, I am getting the following error:


08/06/2022 2:19:13 pm

Exception: Call to GoogleAdsService.Search failed: Cannot select or filter on the following metrics: 'impressions'(could not support requested resources: 'ASSET'), since metric is incompatible with the resource in the FROM clause or other selected segmenting resources. at adsapp_compiled:18052:138 at adsapp_compiled:18063:9 at ra (adsapp_compiled:227:15) at Object.search (adsapp_compiled:235:20) at $H.search (adsapp_compiled:18178:36) at JH.search (adsapp_compiled:17755:19) at KH.search (adsapp_compiled:17850:20) at RH.search (adsapp_compiled:17942:19) at ed (adsapp_compiled:1042:32) at ed.next (<anonymous>)

The line of code that throws the error is

var sitelinkIterator = AdsApp.extensions().sitelinks().withCondition("metrics.impressions > 0").forDateRange("LAST_MONTH").get();

Google Ads Scripts Forum Advisor

unread,
Jun 8, 2022, 4:48:16 AM6/8/22
to adwords...@googlegroups.com

Hello Petra,

 

I am Maia from the Google Ads Scripts Team. Thank you for reaching out to us.

 

For us to investigate further, can you kindly provide your Google Ads account ID / CID and the script name where the issue is reproducible?

 

Kindly send the requested details above via ‘Reply privately to author’ option. However, if the private option is not available on your end, then please send it over through this email <googleadsscr...@google.com> instead.

 

Best Regards,

Google Logo
Angel Maia
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2bdQVS:ref

Petra Manos

unread,
Jun 10, 2022, 2:12:14 AM6/10/22
to Google Ads Scripts Forum
Yes, I'll send through the email now.

Richard Schremmer

unread,
Jun 20, 2022, 10:45:06 AM6/20/22
to Google Ads Scripts Forum
HI guys,

I am unable to retrieve the sitelinks with 0 impression via GAQL. I tried the feed element sources from the Google Ads API without any sucess. The values I get do not correspond with what is in the account, which is rather weird behavior.

I tried the other way with sitelinkselectors on ad group level but that does not work due to time constraints. Since parallel execution is not repaired yet in Beta I dont see a way to get my sitelinks read out.

Can you help me to retrieve sitelinks?

Regards

Richard

Google Ads Scripts Forum Advisor

unread,
Jun 21, 2022, 2:43:14 AM6/21/22
to adwords...@googlegroups.com
Hi Richard,


Thank you for reaching out to us.

With regard to your concern, please do note that the Google Ads Scripts new experience utilizes Google Ads API reports which does not support "zero impression rows". If you want zero-impression rows, then you will need to issue second reporting query that does not segment the data or select/filter by stats. You could then cross-reference the results of that query with their original query. More information can be found here.

Regards,
Google Logo
Teejay Wennie
Google Ads Scripts Team
 

 

ref:_00D1U1174p._5004Q2bdQVS:ref

Richard Schremmer

unread,
Jun 22, 2022, 5:49:54 AM6/22/22
to Google Ads Scripts Forum on behalf of adsscripts

Hi Teejay,

 

the source you have provided does not speak about how to get data with 0 values, it only explains how to avoid 0 values. I have tried my code with date segmentation but it is still not working.

 

Account: PLM652-218-7028

 

Script: PLM 652-218-7028 – Anzeigenchecker

 

Regards

 

Richard

 

Dentsu Germany GmbH, Amtsgericht Frankfurt/Main, HRB 117289, USt-IdNr.: DE 815 235 688

Geschäftsführung: Werner aus den Erlen, Georg Berzbach, Walter Hassler, Nathalie Schubert, Björn Osterndorff, Giulio Malegori, Chris ter Welle

The content of this email and any attachments are private and confidential. If you are not the intended recipient(s) or have otherwise received this email in error, please delete the email and inform the sender as soon as possible. This email may not be disclosed, used or copied by anyone other than the intended recipient(s). Any opinions, statements or comments contained in this email are not necessarily those of dentsu Germany. If you wish clarification of any matter, please request confirmation in writing.

We take precautions to minimise the risk of this email containing a software virus but you should use virus checking software.                                                                                 
Please consider the environment  before printing this email.

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to a topic in the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/G9jRkBjsoWQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/kh9OS000000000000000000000000000000000000000000000RDTENU00U8V1O_XZQvyOZCnuJzdQqA%40sfdc.net.

Richard Schremmer

unread,
Jun 22, 2022, 7:19:19 AM6/22/22
to Google Ads Scripts Forum
Hi Teejay,

I came across this, basically this google article states that sitelink feeds were migrated to assets: 


Thus, I think that the FROM part in GAQL does not work with feed elements as a source.

However, I have tried a new line of code without any succes:

SELECT asset.policy_summary.approval_status, asset.sitelink_asset.description1, asset.sitelink_asset.description2, asset.type, customer.descriptive_name, customer.id, campaign.name, ad_group.name FROM ad_group_ad_asset_view WHERE asset.type = 'SITELINK'"

I hoped that FROM ad_group_ad_asset_view would do the job but I did not get any results back. Could you please assist me to read out the sitelinks by GAQL?

Regards

Richard

Richard Schremmer

unread,
Jun 22, 2022, 7:38:29 AM6/22/22
to Google Ads Scripts Forum
Hi Teejay,

I have further found this thread in the api forum:


I might have the same problem. All my accounts have sitelinks but I get no results. According to the migration plan all extension feed elements must have become assets already. Unfortunately I am not able to run the python code in order find out if my accounts have already been migrated. If you find this argumentation plausible could you please further look into this? Reading out sitelinks per script should be a basic thing to do. All in all I find the script documention for beta pretty bad when it comes to topics strongly related to the google ads api.

Regards

Richard

Google Ads Scripts Forum Advisor

unread,
Jun 23, 2022, 1:08:31 AM6/23/22
to adwords...@googlegroups.com
Hi Richard,

Thank you for pointing this out. It is indeed that sitelink feeds were migrated to assets based. This is the reason why you can't fetch them using AdsApp method on new experience. You can continue to work with your current feed-based extensions through the Google Ads Scripts legacy (turning off the new experience toggle on script interface). However, feed-based extensions will soon become unavailable and asset-based extensions are only available on the new Google Ads Scripts experience. We recommend migrating your legacy Google Ads Scripts to the new Google Ads Scripts experience as soon as feasible. You may want to check this link on how you would migrate your Ad Extensions Scripts.

Richard Schremmer

unread,
Jun 23, 2022, 6:18:49 AM6/23/22
to Google Ads Scripts Forum
Hi Teejay,

I have read all the info in the provided link but I still do not understand why I cant retrieve sitelinks with GAQL. Could you tell me which FROM clause in GAQL you would use to get the final url and sitelink descriptions? What I had tried gave me sitelinks which I could not find in the respective accounts. They all should be auto migrated to asset based meanwhile so I should get valid results when using GAQL.

The way understand the article is that AdsApp will always work:

The existing set of Ad Extension selectors (for example, the SitelinkSelector are capable of fetching either feed-based ad extensions or asset-based ad extensions. By default, these selectors will return whichever type of ad extension is currently serving. The following table summarizes the type of ad extension that is currently serving (and thus will be returned by default).


This might be different for GAQL  but unfortunately there is no info provided for the Google Ads API. I find the FROM clauses rather confusing because there is no clear explanation what you actually retrieve from the source. Explaining things by repetition wont work like in 


ad_group_asset
A link between an ad group and an asset.
https://developers.google.com/google-ads/api/fields/v11/overview?hl=en


Will I get all sitelinks I can see in the account by using ad_group_asset as FROM clause? Migration does not play any role here, does it? All sitelinks should be assets by now. Yes or No?

https://developers.google.com/google-ads/api/fields/v11/ad_group_asset_query_builder?hl=en




Petra Manos

unread,
Jun 24, 2022, 2:04:51 AM6/24/22
to Google Ads Scripts Forum
Hi, I am not sure if Richard's issue is related to mine, but mine is still unresolved.

In my case I specifically targeted sitelinks with impressions > 0, so I think Richard's issue is parallel to mine.

Is it no longer possible to get sitelinks with AdsApp.extensions().sitelinks() ?

Best wishes,

Petra Manos

Petra Manos

unread,
Jun 24, 2022, 2:29:57 AM6/24/22
to Google Ads Scripts Forum
OK, so I read through the links that Richard supplied, and basically sitelinks are now assets since May 22 and so the code I had working before with

var sitelinkIterator = AdsApp.extensions().sitelinks().withCondition("metrics.impressions > 0").forDateRange("LAST_MONTH").get();

was probably getting legacy sitelinks prior to May 22. Now that it is June 24 I have more instances where this script is not working.

So looking at the documents, it seemed that the problem here is "metrics.impressions > 0" does not exist on the GAQL for assets. I looked at assets and they have no metrics at all, so no wonder this does not work. It appears that dates are not relevant either, so I had to change to

var sitelinkIterator = AdsApp.extensions().sitelinks().get();

This does work, i.e. not throwing any exceptions. Although it gives a lot of sitelinks which concerns me.

I explicitly don't want old sitelinks that no longer exist on the account, because if the URL gives a 404 but was already removed as a sitelink a long time ago I don't want to have to continue checking this. As for whether this is the case or not now that it has changed to assets I cannot say.

Petra Manos

unread,
Jun 24, 2022, 2:35:05 AM6/24/22
to Google Ads Scripts Forum
Google Ads script support, I can see that there are now queries on sitelink for
asset.sitelink_asset.end_date
asset.sitelink_asset.start_date

However I am wanting to query sitelinks that ran during a specific date range, they do not have to have been explicitly scheduled to start or end during that date. Most of my sitelinks are evergreen; not scheduled.

Richard Schremmer

unread,
Jun 24, 2022, 3:26:06 AM6/24/22
to Google Ads Scripts Forum
Hi all,

I have made at least some progress and identified the correct source for the FROM clause:

"SELECT asset.name, asset.id, asset.sitelink_asset.description1, asset.sitelink_asset.description2, asset.type, customer.id, customer.descriptive_name, metrics.impressions, asset.policy_summary.policy_topic_entries, campaign.name, ad_group.name, asset.final_urls, asset.policy_summary.approval_status, campaign.status, ad_group.status FROM ad_group_asset WHERE asset.type = 'SITELINK' AND asset.policy_summary.approval_status = 'DISAPPROVED' AND campaign.status = 'ENABLED' AND ad_group.status = 'ENABLED'";    

At least this way I got correct insults, however, this query still includes sitelinks which I can't no longer find in the ad group linked to the query. I ll have a look into this again today. Perhaps I all have to add another filter.

Any help with how to extract only existing, disapproved sitelinks is highly appreciated, I have only extracted disapproved and partially existing sitelinks so far. By existing I mean that I am able to find the sitelink listed in the sitelink section of an ad group. I have no idea how to access other sitelinks which might exist somewhere in the databank.

Please make it clearer in the google script website for everyone else. We need to know the correct source and apply correct filters.

@Petra You can modify my query above with segments.date in the where clause. This way you get sitelinks of a certain period.

Regards

Richard

Petra Manos

unread,
Jun 24, 2022, 3:54:39 AM6/24/22
to Google Ads Scripts Forum
Thanks Richard. It feels like having the rug pulled out from under you when the API is changed before sufficient documentation is added. There is very little example Google Ads script in the reference material so it can be quite difficult to mentally bridge the gap as to how you find a particular class of object in the object model.

Richard Schremmer

unread,
Jun 24, 2022, 3:59:45 AM6/24/22
to Google Ads Scripts Forum
Hi all,

I had a bid of tunnel vision yesterday after working for hours with this issue. My query actually works perfectly. When I was cross checking my results I read the campaign names from right to left and was under the assumption that I had only one campaign in the account I used for checking purposes, however, there were plenty.

So I guess the problem is solved.

@Petra

You can build your query here:


Use segments.date in the where clause. If you want you can also filter for 0 impression by using metrics.impressions = 0.

@googleTeam I can only repeat that the documentation has a lot of flaws which you fall victim to, as well. The sitelinks have migrated to assets, true, but there has never been an issue with that. Just make it clear how to write a GAQL query and point to the correct sources as the API is not self explanatory in some cases.

Regards

Richard

Petra Manos

unread,
Jun 24, 2022, 4:14:55 AM6/24/22
to Google Ads Scripts Forum
Hi Richard, thanks for putting in the hard yards with this one...

I note you suggested ad group asset builder. Most of my sitelinks are in campaigns rather than ad groups. I saw there is a Campaign Asset type as well. Are you suggesting to move away from AdsApp and instead to use a GAQL query on the Campaign Asset (or Ad Group Asset) via the new reports interface?

I saw that Asset on its own does not have a metrics field available, so perhaps that is why my query was failing, but hopefully doing a GAQL query instead will fix the problem.

@Google Ads Script Team - why did you not suggest an appropriate GAQL query for me to use?

Richard Schremmer

unread,
Jun 24, 2022, 4:28:28 AM6/24/22
to Google Ads Scripts Forum
Hi Petra,

you can get the impressions in the metrics section if your source is  ad group asset. This works for both the select clause and the where clause. Metrics actually relates to the asset but in the api it is kept separately for reasons I cant tell.

In the past I created my script in the legacy version and I have also migrated scripts to beta and created entirely new scripts in beta. From experience I can tell that beta works significantly better with GAQL queries. You get huge time advantages and in many cases I dont even need the execution in parallel function any more. That is why I would advise to use GAQL whereever possible. I do understand though that the api is an obstacle you will have to overcome, the AdsApp lego like system is what beginners will prefer but it will influence your code badly once you write scripts to process over 50 accounts etc (I do as I work for an agency specialised in performance marketing). Yesterday it was a lot of try and error until I found the correct source

Petra Manos

unread,
Jun 24, 2022, 5:00:07 AM6/24/22
to Google Ads Scripts Forum
Yes, I am running scripts against 30+ accounts and running into headaches. I also have many of my scripts timing out on the Beta experience, I am guessing I will have to rewrite sections.

I am still having trouble with this but realised that many of my sitelinks are assigned to the Account, not a specific campaign or Ad Group. So I don't think I can access metrics or date range.

Petra Manos

unread,
Jun 24, 2022, 5:07:05 AM6/24/22
to Google Ads Scripts Forum
I tried pulling all assets from the asset table, and I only have TEXT, IMAGE, and PROMOTION asset types coming up. But I know I have various extensions, including sitelinks. I can see they are assigned to the Account.

Did you run into this at all Richard? Did you have to assign your sitelinks to Campaigns or Ad Groups for your query to work?

I tried checking ad_group_asset table and the campaign_asset table and they were not available on those tables.

Richard Schremmer

unread,
Jun 24, 2022, 5:36:26 AM6/24/22
to Google Ads Scripts Forum
Hi Petra,

use this as a starting point:

"SELECT asset.name, asset.id, asset.sitelink_asset.description1, asset.sitelink_asset.description2, asset.type, customer.id, customer.descriptive_name, metrics.impressions, asset.policy_summary.policy_topic_entries, campaign.name, ad_group.name, asset.final_urls, asset.policy_summary.approval_status, campaign.status, ad_group.status FROM ad_group_asset WHERE asset.type = 'SITELINK' campaign.status = 'ENABLED' AND ad_group.status = 'ENABLED' AND ad_group_asset.status = 'ENABLED' AND segments.date DURING LAST_MONTH"



metrics.impressions will retrieve the impressions of the asset
asset.type = 'SITELINK' will ensure you get only sitelinks and no other assets
segments.date DURING LAST_MONTH will give you the data of the selected period, DURING can be changed to BETWEEN as well but you will have to strictly follow the date format

I had no sitelinks on campaign or account level. Changing the source (FROM clause) to campaign_asset or customer_asset seems to be the way to go.  So you will have to run 3 queries per account (this was the same in legacy).

Also note that any parameter you use in the WHERE clause must be present in the SELECT clause.

Google Ads Scripts Forum Advisor

unread,
Jun 24, 2022, 7:21:32 AM6/24/22
to adwords...@googlegroups.com

Hi Richard,
 

Thank you for getting back to us. I work with Teejay and allow me to assist you here.
 

Moving forward, it appears that your concern is more on Google Ads API reports rather than anything specific to the code implementation of the Google Ads Scripts. With that all said, we would recommend raising it to the Google Ads API team via this forum link. The developer support there should be able to provide in-depth insight on this.
 

Regards,

Google Logo
Darwin
Google Ads Scripts Team
 


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