YouTube 数据分析
    
    
      
    
    
      
      使用集合让一切井井有条
    
    
      
      根据您的偏好保存内容并对其进行分类。
    
  
  
      
    
  
  
  
  
  
    
  
  
    
    
    
为频道创建报告
function runYoutubeAnalyticsReport() {
  // Get the list of all channels.
  var myChannels = YouTube.Channels.list('id', {mine: true});
  // Pick the first available channel.
  var channel = myChannels.items[0];
  var channelId = channel.id;
  // Set the dates for report.
  var today = new Date();
  var oneMonthAgo = new Date();
  oneMonthAgo.setMonth(today.getMonth() - 1);
  var todayFormatted = Utilities.formatDate(today, 'UTC', 'yyyy-MM-dd');
  var oneMonthAgoFormatted = Utilities.formatDate(oneMonthAgo, 'UTC',
      'yyyy-MM-dd');
  // See https://developers.google.com/youtube/analytics/v1/reports for
  // supported dimensions and metrics.
  var analyticsResponse = YouTubeAnalytics.Reports.query(
    'channel==' + channelId,
    oneMonthAgoFormatted,
    todayFormatted,
    'views,likes,dislikes,shares',
    {
      dimensions: 'day',
      sort: '-day'
    });
  console.log(analyticsResponse);
}
  
  
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
  最后更新时间 (UTC):2025-08-21。
  
  
  
    
      [null,null,["最后更新时间 (UTC):2025-08-21。"],[],[]]