View as Markdown
YouTube Analytics icon

YouTube Analytics ACTION

Get Video Metrics

Retrieve detailed analytics for a specific video. See the documentation
  • Action
  • Read only
  • OAuth
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's YouTube Analytics account once, then configure and run Get Video Metrics from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "youtube_analytics_api-get-video-metrics",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    youtube_analytics_api: { authProvisionId: "apn_xxxxxxx" },
    startDate: "Start Date",
    endDate: "End Date",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Get Video Metrics inputs
Property Type Description
startDate Start Date string
The start date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format.
Required
endDate End Date string
The end date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format. The API response contains data up until the last day for which all metrics in the query are available at the time of the query. So, for example, if the request specifies an end date of July 5, 2017, and values for all of the requested metrics are only available through July 3, 2017, that will be the last date for which data is included in the response. (That is true even if data for some of the requested metrics is available for July 4, 2017.)
Required
dimensions Dimensions string[]
A list of YouTube Analytics dimensions, such as video or ageGroup, gender. See the documentation for channel reports or content owner reports for a list of the reports that you can retrieve and the dimensions used for those reports. (The Dimensions document contains definitions for all of the dimensions.).
Optional
sort Sort string[]
A list of dimensions or metrics that determine the sort order for YouTube Analytics data. By default the sort order is ascending. The - prefix causes descending sort order. Eg. -views.
Optional
maxResults Max Results integer
The maximum number of rows to include in the response.
Optional
idType ID Type string
The type of ID to use for the query. This can be either My Channel, Channel ID, or Content Owner.
Required
ids Channel ID OR Content Owner Name string
Required when ID Type is Channel ID (e.g. UC_x5XG1OV2P6uZZ5FSM9Ttw) or Content Owner (e.g. MyContentOwnerName or contentOwner@example.com), and unused when ID Type is My Channel.
Optional
videoId Video ID string
The ID of the video for which you want to retrieve metrics. Eg. pd1FJh59zxQ.
Required
metrics Metrics string[]
Metrics, such as views or likes, dislikes. Use the Get Channel Report Metrics action to get a list of the metrics available in each report. See the documentation for channel reports or content owner reports for a list of the reports that you can retrieve and the metrics available in each report. (The Metrics document contains definitions for all of the metrics.).
Required

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
youtube_analytics_api-get-video-metrics
Version
0.0.5
App
YouTube Analytics
Authentication
OAuth
Read-only
Yes
Destructive
No
Open world
Yes