Not possible to add sitelinks, callouts (and possibly the other extensions)

196 views
Skip to first unread message

Sigurd Fabrin

unread,
Mar 25, 2022, 7:51:58 AM3/25/22
to Google Ads Scripts Forum
Hi,

It is currently not possible to add extensions to accounts, campaigns or adGroups.

Error message "An error occurred. Please try again later."

Same error for new/old

Here's an example code taken from your documentation that produce the error:
 const newSitelink = AdsApp.extensions().newSitelinkBuilder()
      .withLinkText('Music')
      .withFinalUrl('http://www.example.com/Music')
//   .withMobilePreferred(true)   // btw: this has been depreciated
      .build()
      .getResult();
  const campaignIterator = AdsApp.campaigns()
      .withCondition('campaign.name = "Some Campaign"')
      .get();
  if (campaignIterator.hasNext()) {
    const campaign = campaignIterator.next();
    campaign.addSitelink(newSitelink);
  }


Here's an example code taken from your documentation that produce the error:
const newCallout = AdsApp.extensions().newCalloutBuilder()
      .withText('Free Shipping')        
  // .withMobilePreferred(true)    // btw: this has been depreciated
      .build()
      .getResult();
  const campaignIterator = AdsApp.campaigns()
      .withCondition('campaign.name = "Some Campaign')
      .get();
  if (campaignIterator.hasNext()) {
    const campaign = campaignIterator.next();
    campaign.addCallout(newCallout);
  }



Thanks
Sigurd

Google Ads Scripts Forum Advisor

unread,
Mar 28, 2022, 6:07:55 AM3/28/22
to adwords...@googlegroups.com
Hi Sigurd,

Thank you for reporting this. I've raised this to the rest of the team for further investigation. I'll update this thread the soonest the team provide their feedback.

Regards,
Google Logo
Teejay Wennie
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2YrOYS:ref

Sigurd Fabrin

unread,
Apr 19, 2022, 6:02:47 AM4/19/22
to Google Ads Scripts Forum
Hi, any news regarding this issue?

Google Ads Scripts Forum Advisor

unread,
Apr 21, 2022, 3:01:43 AM4/21/22
to adwords...@googlegroups.com
Hi Sigurd,

The team provided their feedback and mentioned that you may call build(false) as mentioned in the documentation: https://developers.google.com/google-ads/scripts/docs/features/ad-extensions-migration#update. This should force it to use asset-based extensions.

Sigurd Fabrin

unread,
Apr 22, 2022, 7:32:47 AM4/22/22
to Google Ads Scripts Forum
Hi,

So, the problem is adding extensions to entities, not creating them.

Below I have highlighted the part of the code (from your documentation) that is not working

function createSitelink() {
  // For full details on creating a new sitelink extension, see:
  // https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_sitelinkbuilder
  const newSitelink = AdsApp.extensions().newSitelinkBuilder()
      // Replace the values below with your link link text, final url, and
      // mobile preferred
      .withLinkText('Music')                          // required
      .withFinalUrl('http://www.example.com/Music')   // required
 //     .withMobilePreferred(true)                      // optional
      .build() // This works fine
      .getResult();

  // Add sitelink to a campaign
  const campaignIterator = AdsApp.campaigns()
      .withCondition('campaign.name = "INSERT_CAMPAIGN_NAME_HERE"')

      .get();
  if (campaignIterator.hasNext()) {
    const campaign = campaignIterator.next();
    campaign.addSitelink(newSitelink); // this does not work
  }

Google Ads Scripts Forum Advisor

unread,
Apr 26, 2022, 2:25:56 AM4/26/22
to adwords...@googlegroups.com

Hello Sigurd,

I’m James, also a member of the Google Ads scripts support team. Allow me to assist you further.

Can you please confirm if you only encountered the said issue within campaign.addSitelink() upon executing your script in preview mode or actual running? I asked this because upon trying the given sample code in our test account, I only encountered the issue upon executing the said script in preview mode. However, upon actual running the script, it works successfully. 

Regards,

Google Logo
James Howell
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2YrOYS:ref

Sigurd Fabrin

unread,
Apr 26, 2022, 3:09:12 AM4/26/22
to Google Ads Scripts Forum
Great it is now possible to add extensions again :)

It still throws an error in preview though but that's not critical


Thanks
Sigurd

Google Ads Scripts Forum Advisor

unread,
Apr 27, 2022, 11:22:25 PM4/27/22
to adwords...@googlegroups.com

Hello Sigurd,

I believe that the error shown in preview mode is expected because when scripts are executed in preview mode, they make no changes to the actual ads data. Instead, script execution shows the changes that would have been made had the script been executed under the changes tab inside of the script interface.

Let me know if you have any questions.

Regards,

Reply all
Reply to author
Forward
0 new messages