N8N Tools - YouTube Enhanced icon

N8N Tools - YouTube Enhanced

Comprehensive YouTube Data API v3 and Analytics integration for N8N workflows

Actions83

Overview

The node provides enhanced integration with YouTube's Data API v3 and Analytics API, allowing users to retrieve detailed analytics data for YouTube content owners. Specifically, the "Get Content Owner Analytics" operation fetches various performance metrics and dimensions related to a YouTube Content Owner's account over a specified date range. This is useful for content managers, multi-channel networks, or agencies managing multiple YouTube channels under a content owner account who want to analyze aggregated analytics data.

Common scenarios include:

  • Monitoring overall channel and video performance across all managed channels.
  • Tracking revenue, engagement, and audience demographics at the content owner level.
  • Generating reports on subscriber growth, ad performance, and viewer behavior grouped by different dimensions such as date, country, device type, etc.

Practical example:
A media agency managing multiple YouTube channels can use this node to pull comprehensive analytics reports for their entire content owner account, filtering by specific metrics like views, estimated revenue, and subscribers gained, grouped by day or country, to optimize content strategy and monetization.

Properties

Name Meaning
Content Owner ID The unique identifier of the YouTube Content Owner whose analytics data is being requested.
Start Date The start date for the analytics data range (inclusive).
End Date The end date for the analytics data range (inclusive).
Metrics List of metrics to include in the analytics report. Options include: Views, Estimated Minutes Watched, Average View Duration, Subscribers, Likes, Comments, Estimated Revenue, CPM, Impressions, and many more. Default includes "views" and "estimatedMinutesWatched".
Dimensions Dimensions to group the analytics data by. Options include Date, Month, Year, Video, Playlist, Channel, Age Group, Gender, Country, Device Type, Operating System, Browser, Traffic Source Type, Revenue Source Type, Ad Type, Subscribed Status, Playback Location Type, Annotation Type, Card Type, Sharing Service, Live or On Demand, Content Type, Elapsed Video Time Ratio. Default is "day".
Sort Sort order for the results, e.g., "-views" to sort descending by views.
Filters Filters to apply to the analytics data to narrow down the results.
Max Results Maximum number of results to return (between 1 and 1000). Default is 100.
Start Index Index of the first result to return (minimum 1).

Output

The output is a JSON array where each item contains the analytics data retrieved from YouTube for the specified content owner and parameters. The structure typically includes rows of analytics data grouped by the selected dimensions, with values for each requested metric.

Example output JSON structure (simplified):

{
  "kind": "youtubeAnalytics#resultTable",
  "columnHeaders": [
    {"name": "day", "type": "DIMENSION"},
    {"name": "views", "type": "METRIC"},
    {"name": "estimatedRevenue", "type": "METRIC"}
  ],
  "rows": [
    ["2024-01-01", 12345, 67.89],
    ["2024-01-02", 23456, 78.90]
  ]
}

No binary data output is involved in this operation.

Dependencies

  • Requires an active subscription and valid API key credential for the external N8N Tools API service that validates usage.
  • Requires OAuth2 credentials for YouTube API access.
  • The node internally uses helper classes to interact with YouTube's Analytics API endpoints.
  • No additional environment variables are explicitly required beyond standard n8n credential setup.

Troubleshooting

  • Invalid subscription or API key error: If the node throws an error about invalid subscription or API key, verify that the API key credential configured in n8n is correct and has an active subscription.
  • Permission errors: Ensure the OAuth2 credentials used have sufficient permissions to access YouTube Analytics data for the specified content owner.
  • Empty or incomplete data: Check that the date range and filters are correctly set and that the content owner ID is valid.
  • Rate limits: YouTube API enforces quota limits; excessive requests may cause failures. Consider reducing max results or adding delays between executions.
  • Incorrect parameter values: Using unsupported metrics or dimensions together may cause API errors. Refer to YouTube Analytics API documentation for valid combinations.

Links and References

Discussion