Google ads scripts: newVideoAd This is not implemented yet. For currently supported API

Viewed 78
8/3/2022 13:40:32   NotImplementedError: This is not implemented yet. For currently supported API, see: https://developers.google.com/google-ads/scripts-beta/docs/reference/adsapp/adsapp
at Ha (adsapp_compiled:298:11)
at new $y (adsapp_compiled:13027:5)
at qC.newVideoAd (adsapp_compiled:15250:12)
at Object.<anonymous> (adsapp_compiled:18396:54)

    var youtubeVideoId = "youtubeVideoId";
    var adGroupName = "adGroupName" // name of my target video ad group
    var displayUrl = "display-url.com";
    var finalUrl = "https://final-url.com";

    var assetOperation = AdsApp.adAssets().newYouTubeVideoAssetBuilder()
        .withName(adName)
        .withYouTubeVideoId(youtubeVideoId)
        .build();
    var videoAsset = assetOperation.getResult();
    
    var videoAdGroup = AdsApp.videoAdGroups()
        .withCondition(`Name = '${adGroupName}'`)
        .withLimit(1)
        .get()
        .next();
    
    var videoAdOperation = videoAdGroup.newVideoAd().inStreamAdBuilder()
        .withVideo(videoAsset)
        .withAdName(adName)
        .withDisplayUrl(displayUrl)
        .withFinalUrl(finalUrl)
        .build()
        .getResult();
    
    // Code crash before next statement

    if(videoAdOperation.isSuccessful()) {
        var videoAd = videoAdOperation.getResult();
        Logger.log("VideoAd " + videoAd.getName() + " created.");
    } else {
        Logger.log(videoAdOperation.getErrors());
    }

Code breaks after videoAdGroup.newVideoAd().inStreamAdBuilder().

Following the google ads script docs everything should works nice.

enter image description here

But when I compile the script, I always get the next error: enter image description here

I have just found in a Google ads scripts forum somebody who has the same problem here but no solution.

1 Answers

The problem is that beta mode which is active by default. Must be switched off for this action.

enter image description here

As a negative point, switch off Beta mode will not allow you to use javascript arrow functions, neither js classes.

Related