get_account_insights
Retrieve Instagram business account analytics including reach, profile views, website clicks, and engagement metrics for performance tracking.
Instructions
Get account-level insights and analytics for Instagram business account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | No | Instagram business account ID (optional) | |
| metrics | No | Specific metrics to retrieve | |
| period | No | Time period for insights | day |
Implementation Reference
- src/client.ts:386-400 (handler)The implementation of the getAccountInsights method which fetches insights from the Instagram Graph API.
async getAccountInsights( metrics?: string[], period = "day", accountId?: string ): Promise<IGInsight[]> { const id = accountId ?? this.aid(); const defaultMetrics = ["reach", "profile_views", "website_clicks"]; const data = await this.request("GET", `${id}/insights`, { params: { metric: (metrics ?? defaultMetrics).join(","), period, metric_type: "total_value", }, }); return data.data ?? []; - src/index.ts:154-168 (registration)The registration of the get_account_insights tool, including its description and input schema.
{ name: "get_account_insights", description: "Get account-level insights and analytics for Instagram business account", inputSchema: { type: "object" as const, properties: { account_id: { type: "string", description: "Instagram business account ID (optional)" }, metrics: { type: "array", items: { type: "string", enum: ["reach", "profile_views", "website_clicks", "accounts_engaged"] }, description: "Specific metrics to retrieve", }, period: { type: "string", enum: ["day", "lifetime"], description: "Time period for insights", default: "day" }, }, - src/index.ts:393-398 (handler)The tool handler switch-case block that invokes the client's getAccountInsights method.
case "get_account_insights": { const insights = await c.getAccountInsights( args.metrics, args.period ?? "day", args.account_id );