系统推荐的展示位置排除

工具图标

有时,某些视频的目标受众群体与您的广告不同,但您可能在开始累积统计信息之前不知道这一点。如果您发现某个展示位置的效果根本没有达到您的预期,可以将其从定位中删除。

此脚本会自动识别并排除未达到您为视频广告设置的观看次数阈值的展示位置(不是 YouTube 网址)。

正在安排

该脚本会考虑过去 7 天的统计信息。请将其设为每周运行。

运作方式

对于您帐号中的每个广告系列,脚本都将通过相同的流程运行:

  • 查找指定广告系列在过去一周的视频效果统计信息,尤其是观看率。
  • 对于低于特定观看率阈值(可配置)的每个网址,请为相应展示位置添加定位排除对象,以防止您的广告继续在这些展示位置展示。

如果观看率对您来说不是最重要的统计信息,您可以修改脚本,使用在评估展示位置时您看重的一组参数。

参数

此脚本中的唯一参数是 VIEW_RATE_THRESHOLD。它用于指定用户观看广告的次数的目标百分比。系统会排除低于此阈值的展示位置。

初始设置

  • 使用下面的源代码创建新脚本。
  • 在粘贴的代码中更新 VIEW_RATE_THRESHOLD
  • 请检查用于确定何时排除展示位置的标准,并在必要时进行更新。
  • 将脚本设为每周运行。

源代码

// Copyright 2016, Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


/**
 * @name Automatic Placement Exclusions
 *
 * @overview The Automatic Placement Exclusions script analyzes the
 *     performance of your video ads across various placements, and then
 *     automatically excludes them from appearing for URLs that have
 *     underperformed based on VideoViewRate.
 *     See
 *     https://developers.google.com/google-ads/scripts/docs/solutions/automatic-placement-exclusion
 *     for more details.
 *
 * @author Google Ads Scripts Team [adwords-scripts@googlegroups.com]
 *
 * @version 2.0
 *
 * @changelog
 * - version 2.0
 *   - Updated to use new Google Ads scripts features.
 * - version 1.0
 *   - Released initial version.
 */


// The view rate under which placements will be automatically excluded.
let VIEW_RATE_THRESHOLD = '10.00%';

// Exclude any placements that don't have at least this many impressions in the
// last 7 days to reduce noise.
const MIN_IMPRESSIONS = 50;

function main() {
  VIEW_RATE_THRESHOLD = parseFloat(VIEW_RATE_THRESHOLD);
  const results = getReportResults();
  const ids = [];
  for (const id in results) {
    ids.push(id);
  }
  const videoCampaignIterator = AdsApp.videoCampaigns()
      .withIds(ids)
      .get();
  for (const videoCampaign of videoCampaignIterator) {
    const id = videoCampaign.getId();
    if (results.hasOwnProperty(id)) {
      const urls = results[id];
      for (const url of urls) {
        videoCampaign.videoTargeting().newPlacementBuilder()
            .withUrl(url)
            .exclude();
      }
    }
  }
}

function getReportResults() {
  const query = `SELECT campaign.id, ` +
        `detail_placement_view.target_url ` +
        `FROM detail_placement_view ` +
        `WHERE metrics.impressions >= ${MIN_IMPRESSIONS} ` +
        `AND metrics.video_view_rate < ` +
        `${(VIEW_RATE_THRESHOLD / 100)} ` +
        `AND segments.date DURING LAST_7_DAYS`;
  const report = AdsApp.report(query);
  const rows = report.rows();
  const results = {};
  for (const row of rows) {
    const campaignId = row['campaign.id'];
    const url = row['detail_placement_view.target_url'];
    if (!results.hasOwnProperty(campaignId)) {
      results[campaignId] = [];
    }
    if (results[campaignId].indexOf(url) < 0) {
      results[campaignId].push(url);
    }
  }
  return results;
}