# Instagram Analytics Pro (`constant_quadruped/instagram-analytics-pro`) Actor

Transform Instagram data into influencer analytics. Flattens nested childPosts, musicInfo & comments. Computes engagement rates, profile scores (0-100), comment sentiment, and trending audio from Reels. Compare multiple profiles with HTML dashboard. CRM-ready exports for marketing teams.

- **URL**: https://apify.com/constant_quadruped/instagram-analytics-pro.md
- **Developed by:** [CQ](https://apify.com/constant_quadruped) (community)
- **Categories:** Social media, Lead generation
- **Features:** Limited permissions
- **Stats:** 148 total users, 0 monthly users, 100.0% runs succeeded, 5 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Instagram Analytics Pro

Transform raw Instagram data into **actionable influencer analytics**. This Actor wraps Apify's Instagram scrapers and adds derived insights you can act on immediately.

### How It Works (Data Source)

This Actor does **not** use the official Instagram Graph API and does **not** require you to provide credentials. On each run it calls three public Apify Instagram scrapers and then computes analytics on top of the returned data:

- `apify/instagram-profile-scraper` — profile metadata (followers, following, post count, verification, business contact fields)
- `apify/instagram-scraper` — recent public posts for each profile
- `apify/instagram-hashtag-scraper` — recent public posts for each hashtag

The **raw numbers (followers, likes, comments, captions, audio) are real, live public data** fetched at run time. Everything else — engagement rate, profile score (0-100), sentiment, best posting times, hashtag/caption/content insights, and recommendations — is **computed/estimated by this Actor** from a limited sample of posts using heuristics (see [Limitations](#limitations)). These are estimates, not official Instagram Insights figures.

### 🚀 Quick Start

1. Click **Start** (default input analyzes a sample profile).
2. Wait ~30-90 seconds for analysis to complete.
3. View the **HTML Dashboard** in the key-value store (key: `REPORT`) and the **full dataset** in the dataset tab.

#### Minimal Input

```json
{
    "profiles": ["cristiano"],
    "maxPostsPerProfile": 20
}
```

#### Multi-Profile Comparison

```json
{
    "profiles": ["cristiano", "leomessi", "neymarjr"],
    "maxPostsPerProfile": 30,
    "maxCommentsPerPost": 10
}
```

#### Hashtag + Monitoring Mode

```json
{
    "hashtags": ["travelphotography", "foodporn"],
    "maxPostsPerProfile": 20,
    "monitoringMode": true,
    "changeThresholdPct": 15
}
```

### 💰 Cost

Most of the cost of a run comes from the **underlying Apify Instagram scrapers** this Actor calls (`apify/instagram-profile-scraper`, `apify/instagram-scraper`, `apify/instagram-hashtag-scraper`), which are billed by their own usage-based pricing. This Actor adds only lightweight compute on top.

Total cost therefore scales with:

- the number of profiles and hashtags analyzed,
- `maxPostsPerProfile` (more posts = more scraping),
- whether comments are fetched for sentiment.

For exact figures, check the current pricing of the underlying scrapers on their Apify Store pages and your account's platform usage rates. Higher post/comment volumes cost proportionally more.

### 📦 Sample Output

#### Run Output (Key-Value Store `OUTPUT`)

This is the run summary object saved to the key-value store (not the dataset):

```json
{
    "profilesAnalyzed": 3,
    "hashtagsAnalyzed": 0,
    "totalPostsProcessed": 90,
    "avgEngagementRate": 4.2,
    "avgProfileScore": 78,
    "leader": { "engagement": "cristiano", "followers": "cristiano", "score": "cristiano" },
    "reportUrl": "https://api.apify.com/v2/key-value-stores/.../records/REPORT",
    "datasetUrl": "https://api.apify.com/v2/datasets/.../items?format=json",
    "completedAt": "2026-04-24T12:00:00Z",
    "runMode": "analysis",
    "changesDetected": 0
}
```

`leader` is an object (top username by engagement/followers/score) when 2+ profiles are compared, and `null` for a single-profile run.

#### Dataset Item (per profile, default `standard` format)

Field names below match the code exactly; values are illustrative. The exact fields depend on `exportFormat` (`standard`, `flat`, or `nested`):

```json
{
    "username": "cristiano",
    "fullName": "Cristiano Ronaldo",
    "followers": 640000000,
    "following": 570,
    "posts": 3800,
    "verified": true,
    "engagementRate": 4.8,
    "avgLikes": 5200000,
    "avgComments": 42000,
    "profileScore": 87,
    "sentimentScore": 0.62,
    "topAudio": "Original audio",
    "bestPostingDay": "Sunday",
    "bestPostingHour": 18,
    "postingTimeRecommendation": "Post on Sundays around 6 PM for 45% higher engagement",
    "bestContentType": "reel",
    "topHashtags": ["#cr7", "#footballlegend"],
    "underperformingHashtags": ["#ad"],
    "captionRecommendations": ["Use emojis (+23% engagement)"],
    "insights": [
        { "type": "tip", "category": "Timing", "message": "Post on Sundays around 6 PM ...", "action": "Schedule posts for Sunday at 6 PM." }
    ],
    "postsAnalyzed": 30,
    "profileUrl": "https://instagram.com/cristiano",
    "scrapedAt": "2026-04-24T12:00:00Z"
}
```

Hashtag runs push a separate record shaped `{ "type": "hashtag_analysis", "hashtag": "#travel", "postsAnalyzed": 20, "audioTrends": {...}, "sentiment": {...}, "topPosts": [...] }`, and multi-profile runs push a `{ "type": "comparison", ... }` record.

### Features

#### Core Analytics

- **Data Flattening**: Converts nested `childPosts`, `musicInfo`, and `latestComments` into clean, structured data
- **Engagement Metrics**: Calculates engagement rates, averages, and profile scores (0-100)
- **Sentiment Analysis**: Analyzes comment sentiment (positive/negative/neutral)
- **Trending Audio Detection**: Tracks audio usage patterns from Reels
- **Profile Comparison**: Compare multiple influencers side-by-side

#### Actionable Insights (NEW)

- **Best Posting Times**: Day/hour heatmap showing when posts get the most engagement
- **Content Type Performance**: Reels vs Carousels vs Images - which format works best
- **Hashtag Analysis**: Top-performing hashtags + underperformers to drop
- **Caption Optimization**: Emoji/CTA/question impact on engagement
- **Top/Worst Posts**: See what's working and what's not
- **Rule-Based Recommendations**: Specific suggested actions derived from your metrics (heuristic rules, not an LLM/AI model)

#### Output

- **HTML Dashboard**: Beautiful visual report with all insights
- **CRM-Ready Export**: Flat format with actionable fields for marketing tools

### Use Cases

- **Influencer Marketing**: Evaluate potential partners before campaigns
- **Competitor Analysis**: Track competitor engagement and content strategy
- **Content Strategy**: Identify trending audio and high-performing content types
- **Brand Monitoring**: Analyze sentiment around branded hashtags

### Input

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `profiles` | Array | `[]` (prefilled `["nike"]`) | Instagram usernames or URLs to analyze |
| `hashtags` | Array | `[]` | Hashtags to analyze (without #) |
| `maxPostsPerProfile` | Integer | `50` | Posts to analyze per profile (1-100) |
| `maxCommentsPerPost` | Integer | `20` | Comments to analyze per post for sentiment (0-50) |
| `includeReels` | Boolean | `true` | Include Reels in analysis |
| `includeCarousels` | Boolean | `true` | Include carousel (multi-image) posts |
| `analyzeSentiment` | Boolean | `true` | Perform lexicon-based comment sentiment analysis |
| `detectTrendingAudio` | Boolean | `true` | Track audio/music usage patterns from Reels |
| `computeEngagement` | Boolean | `true` | Calculate engagement rates, averages, and profile score |
| `generateReport` | Boolean | `true` | Create the HTML dashboard (saved to key-value store as `REPORT`) |
| `exportFormat` | String | `"standard"` | Dataset item shape: `standard`, `flat` (CRM-ready), or `nested` (full data) |
| `compareProfiles` | Boolean | `true` | Generate a comparison record when 2+ profiles are analyzed |
| `monitoringMode` | Boolean | `false` | Persist each run's state and compute deltas (follower/engagement/new posts) vs the prior run |
| `alertOnChange` | Boolean | `false` | Send a webhook alert only when a delta exceeds `changeThresholdPct` (requires `alertWebhookUrl`) |
| `changeThresholdPct` | Integer | `5` | Minimum % change in followers or engagement to trigger an alert (1-50) |
| `alertWebhookUrl` | String | `""` | Optional URL to POST a JSON alert to when change exceeds threshold |

> If both `profiles` and `hashtags` are empty, the Actor falls back to analyzing the demo profile `nike` so a run never starts with nothing to do.

### Output

#### Standard Format

```json
{
  "username": "nike",
  "fullName": "Nike",
  "followers": 306000000,
  "engagementRate": 0.42,
  "avgLikes": 128500,
  "avgComments": 1250,
  "profileScore": 95,
  "sentimentScore": 0.72,

  "bestPostingDay": "Wednesday",
  "bestPostingHour": 14,
  "postingTimeRecommendation": "Post on Wednesdays around 2 PM for 45% higher engagement",

  "bestContentType": "reel",
  "contentBreakdown": { "reel": { "avgLikes": 150000 }, "image": { "avgLikes": 80000 } },

  "topHashtags": ["#justdoit", "#nike", "#sports"],
  "underperformingHashtags": ["#lifestyle", "#photooftheday"],

  "optimalCaptionLength": "medium",
  "captionRecommendations": ["Use emojis (+23% engagement)", "Add CTAs (+18% engagement)"],

  "top5Posts": [{ "url": "...", "engagement": 250000 }],
  "insights": [
    { "type": "tip", "message": "Reels perform best", "action": "Create more Reels" }
  ]
}
```

#### Flat Format (CRM-Ready)

```json
{
  "ig_username": "nike",
  "ig_followers": 306000000,
  "analytics_engagement_rate": 0.42,
  "analytics_profile_score": 95,
  "analytics_sentiment": 0.72,

  "best_posting_day": "Wednesday",
  "best_posting_hour": 14,
  "best_content_type": "reel",

  "top_hashtag_1": "#justdoit",
  "top_hashtag_2": "#nike",
  "emoji_boost_pct": 23,
  "cta_boost_pct": 18,

  "primary_insight": "Reels perform best with 150K avg engagement",
  "primary_action": "Create more Reels to maximize engagement"
}
```

### Profile Score Calculation

The profile score (0-100) is calculated based on:

- **Engagement Rate** (40 points max): 6%+ = 40, 3%+ = 30, 1%+ = 20
- **Follower Count** (20 points max): 1M+ = 20, 100K+ = 15, 10K+ = 10
- **Consistency** (20 points max): Based on total post count
- **Verification** (20 points): Verified accounts get bonus

### Sentiment Analysis

Comments are analyzed using keyword matching and emoji detection:

- **Positive**: love, amazing, fire, 🔥, ❤️, 😍, etc.
- **Negative**: hate, ugly, trash, 👎, 😡, etc.
- **Neutral**: No strong sentiment indicators

Score ranges from -1 (all negative) to +1 (all positive).

### HTML Report

The generated HTML report includes:

- Profile cards with key metrics
- Engagement rate visualization
- Sentiment bars
- Top trending audio list
- Multi-profile comparison rankings

Access the report from the Key-Value Store under the `REPORT` key.

### Pricing

Your total cost is driven by the **underlying Apify Instagram scrapers** this Actor calls (each billed on its own usage-based pricing) plus this Actor's own platform compute. Cost scales with the number of profiles/hashtags, `maxPostsPerProfile`, and whether comments are present to analyze. For current rates, check the pricing shown on the underlying scrapers' Apify Store pages and your account's platform usage pricing.

### Example Usage

#### Single Profile Analysis

```json
{
  "profiles": ["nike"],
  "maxPostsPerProfile": 50,
  "analyzeSentiment": true,
  "generateReport": true
}
```

#### Multi-Profile Comparison

```json
{
  "profiles": ["nike", "adidas", "puma"],
  "maxPostsPerProfile": 30,
  "compareProfiles": true,
  "exportFormat": "flat"
}
```

#### Hashtag Trend Analysis

```json
{
  "hashtags": ["fitness", "workout"],
  "maxPostsPerProfile": 100,
  "detectTrendingAudio": true
}
```

### Integrations

Export data to:

- Google Sheets (via Apify integration)
- HubSpot, Salesforce, Pipedrive (use flat format)
- Zapier/Make for automation
- Custom webhooks

### ❓ FAQ

**Q: Do I need my own Instagram account or API keys?**
A: No. This Actor wraps Apify's Instagram scrapers which handle auth internally.

**Q: How fresh is the data?**
A: Real-time at scrape time. Each run fetches the latest public posts from Instagram.

**Q: Can I analyze private profiles?**
A: No. Only public profiles and public hashtag feeds are accessible.

**Q: What's the difference between `analysis` and `monitoring` mode?**
A: `analysis` is a one-shot insight report. `monitoring` tracks deltas between runs and triggers webhooks when metrics change by more than `changeThresholdPct`. Use monitoring for competitor tracking.

**Q: Why is my `avgEngagementRate` so low?**
A: Engagement rate = (likes + comments) / followers. Large accounts (1M+ followers) naturally have rates under 2%. Micro-influencers often see 5-10%.

**Q: Can I export to Google Sheets automatically?**
A: Yes. Use Apify's Google Sheets integration on the dataset tab. Choose `flat` export format for best CRM compatibility.

### Limitations

- **No official Instagram API / no login** — data is obtained through third-party Apify Instagram scrapers, not the official Instagram Graph API. If those scrapers are unavailable or Instagram changes its site, runs can return partial or no data. If every requested profile/hashtag returns nothing, the run finishes cleanly and writes a single `{ "type": "no_results" }` status record instead of failing or leaving an empty dataset.
- **Public data only** — private accounts and any non-public fields are inaccessible and return no data.
- **Metrics are estimates, not official Insights** — engagement rate, profile score (0-100), best posting times, content/hashtag/caption analysis, and recommendations are **computed heuristics** derived from the fetched sample of posts (capped by `maxPostsPerProfile`). They are not Instagram's own analytics and will differ from Creator/Business account Insights.
- **Sentiment is lexicon-based** — comments are scored with a small fixed keyword and emoji dictionary (no machine learning / no LLM). It is biased toward English and can miss sarcasm, slang, and other languages.
- **Recommendations are rule-based** — "insights" and suggestions come from simple threshold rules, not an AI model.
- **Sample-size sensitivity** — trending-audio results need Reels with audio metadata; best-posting-time results need posts with usable timestamps; sparse data yields "not enough data" outputs.
- **Rate limits** — very large `maxPostsPerProfile` values or many profiles/hashtags per run increase the chance the underlying scrapers hit Instagram throttling (`maxPostsPerProfile` is capped at 100).
- **Comments** — sentiment only runs on the `latestComments` that the post scraper already returns; `maxCommentsPerPost` caps how many of those are analyzed (`0` disables sentiment). The Actor does not perform a separate deep comment scrape.
- **Monitoring mode** needs at least two runs — the first run only stores a baseline; deltas and threshold alerts appear from the second run onward.
- **What it does NOT do** — it does not post, schedule, like, follow, or otherwise write to Instagram; it does not provide follower demographics, Stories, DMs, or historical trend data beyond the posts fetched in the current run.

### Support

For issues or feature requests, open a bug on the Apify Actor page or contact the author via the Apify Console.

# Actor input Schema

## `profiles` (type: `array`):

List of Instagram usernames or profile URLs to analyze (e.g., 'nike' or 'https://instagram.com/nike')

## `hashtags` (type: `array`):

Optional: Analyze posts from specific hashtags (without #)

## `maxPostsPerProfile` (type: `integer`):

Maximum number of posts to analyze per profile (1-100)

## `maxCommentsPerPost` (type: `integer`):

Maximum comments to analyze per post for sentiment (0-50)

## `includeReels` (type: `boolean`):

Include Instagram Reels in analysis

## `includeCarousels` (type: `boolean`):

Include carousel (multi-image) posts - flattens childPosts data

## `analyzeSentiment` (type: `boolean`):

Perform sentiment analysis on comments (positive/negative/neutral)

## `detectTrendingAudio` (type: `boolean`):

Track audio/music usage patterns from Reels

## `computeEngagement` (type: `boolean`):

Calculate engagement rates, averages, and performance scores

## `generateReport` (type: `boolean`):

Create a visual HTML dashboard with charts

## `exportFormat` (type: `string`):

Format for raw data export

## `compareProfiles` (type: `boolean`):

Generate comparison metrics when analyzing multiple profiles

## `monitoringMode` (type: `boolean`):

Persist each run's state and compute deltas (follower/engagement/new posts) vs prior run. Essential for scheduled competitor tracking.

## `alertOnChange` (type: `boolean`):

Only flag reports where follower delta or engagement delta exceeds threshold. Combine with a webhook URL for Slack/email alerts.

## `changeThresholdPct` (type: `integer`):

Minimum % change in followers or engagement to trigger alert

## `alertWebhookUrl` (type: `string`):

Optional: POST a JSON alert to this URL when change exceeds threshold (Slack, Discord, Zapier, custom).

## Actor input object example

```json
{
  "profiles": [
    "nike"
  ],
  "maxPostsPerProfile": 50,
  "maxCommentsPerPost": 20,
  "includeReels": true,
  "includeCarousels": true,
  "analyzeSentiment": true,
  "detectTrendingAudio": true,
  "computeEngagement": true,
  "generateReport": true,
  "exportFormat": "standard",
  "compareProfiles": true,
  "monitoringMode": false,
  "alertOnChange": false,
  "changeThresholdPct": 5
}
```

# Actor output Schema

## `profilesAnalyzed` (type: `string`):

Number of Instagram profiles processed in this run

## `hashtagsAnalyzed` (type: `string`):

Number of hashtag collections processed (0 if none requested)

## `totalPostsProcessed` (type: `string`):

Total posts analyzed across all profiles

## `avgEngagementRate` (type: `string`):

Mean engagement rate across all profiles analyzed

## `avgProfileScore` (type: `string`):

Mean profile score (0-100) across all profiles analyzed

## `leader` (type: `string`):

Username of the highest-scoring profile in the comparison set

## `reportUrl` (type: `string`):

Direct link to the HTML report saved in key-value store under the 'REPORT' key

## `datasetUrl` (type: `string`):

Direct link to the full per-profile analytics dataset

## `completedAt` (type: `string`):

ISO-8601 timestamp when this run finished

## `runMode` (type: `string`):

Either 'analysis' for one-shot runs or 'monitoring' when monitoringMode=true with delta tracking

## `changesDetected` (type: `string`):

Number of profiles where a monitored metric changed by more than changeThresholdPct since the last run. Zero on non-monitoring runs.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "profiles": [
        "nike"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("constant_quadruped/instagram-analytics-pro").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "profiles": ["nike"] }

# Run the Actor and wait for it to finish
run = client.actor("constant_quadruped/instagram-analytics-pro").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "profiles": [
    "nike"
  ]
}' |
apify call constant_quadruped/instagram-analytics-pro --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,constant_quadruped/instagram-analytics-pro"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/L9VddynXdzw0XxkFk/builds/BXWtNVSDKw8fg2PML/openapi.json
