# Traffic Generator (`crawlerbros/traffic-generator`) Actor

Generate realistic website traffic with human-like behavior simulation. Supports any website.

- **URL**: https://apify.com/crawlerbros/traffic-generator.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, Other, SEO tools
- **Stats:** 264 total users, 17 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Traffic Generator

Generate realistic website traffic with human-like behavior simulation. Drive pageviews to any website, YouTube video, Etsy shop, or Behance profile. Each visit includes natural scrolling, mouse movements, variable dwell times, and browser fingerprint randomization to appear as genuine user traffic.

### What can this traffic generator do?

- **Simulate real traffic** -- Visit any URL with human-like browsing behavior including scrolling, mouse movements, and idle time
- **YouTube video views** -- Play YouTube videos with realistic viewing behavior and configurable watch duration
- **Crawl and browse** -- Follow links on target pages to simulate deeper browsing sessions across multiple pages
- **Fingerprint randomization** -- Each session uses a different browser fingerprint (user agent, viewport, timezone, WebGL parameters)
- **Stress testing** -- Rapid request mode for load testing your own websites
- **Resource blocking** -- Block ads and trackers for faster page loads and reduced bandwidth
- **Kill switch** -- Automatically stop after a set time limit to control costs
- **Detailed logging** -- Track every page visit with load times, scroll depth, and interaction metrics

### Use cases

- **SEO and analytics** -- Increase website traffic metrics for testing and validation
- **Load testing** -- Test how your website handles traffic using stress mode
- **YouTube creators** -- Generate views on YouTube videos
- **Etsy shop owners** -- Drive traffic to your Etsy shop listings
- **Behance designers** -- Increase portfolio views
- **Campaign testing** -- Verify analytics tracking is working before launching campaigns
- **Website monitoring** -- Regularly visit pages to check availability and performance

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `startUrls` | URL\[] | Yes | -- | Target URLs to visit |
| `mode` | string | No | PAGEVIEW | PAGEVIEW (human simulation) or STRESS (rapid requests) |
| `enableCrawling` | boolean | No | false | Follow links on visited pages for deeper sessions |
| `crawlingLinkSelector` | string | No | `a[href]` | CSS selector for links to follow when crawling |
| `maxPagesPerUrl` | integer | No | 10 | Max pages per start URL when crawling (1-1,000) |
| `waitOnPage` | integer | No | 30 | Seconds to spend on each page (0-600, varies +/-20%) |
| `endAfterSeconds` | integer | No | 300 | Stop after N seconds (0 = unlimited) |
| `enableYoutube` | boolean | No | false | Enable YouTube video playback simulation |
| `blockResources` | string\[] | No | -- | Additional URL patterns to block |
| `enableAdvancedFingerprinting` | boolean | No | true | Randomize browser fingerprint per session |
| `proxyConfiguration` | object | No | -- | Optional proxy settings for geographic targeting |

#### Example input

```json
{
    "startUrls": [
        { "url": "https://example.com/" },
        { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }
    ],
    "mode": "PAGEVIEW",
    "waitOnPage": 30,
    "endAfterSeconds": 300,
    "enableCrawling": true,
    "maxPagesPerUrl": 5,
    "enableYoutube": true
}
```

```json
{
    "startUrls": [
        { "url": "https://www.etsy.com/shop/YourShopName" }
    ],
    "waitOnPage": 45,
    "endAfterSeconds": 600,
    "enableCrawling": true,
    "maxPagesPerUrl": 10
}
```

### Output

Each page visit produces a record in the dataset with these fields:

| Field | Type | Description |
|-------|------|-------------|
| `url` | string | URL of the visited page |
| `status` | string | Visit result: success, failed, blocked, or timeout |
| `pageTitle` | string | HTML title of the page |
| `loadTimeMs` | number | Page load time in milliseconds |
| `timeOnPageSec` | number | Seconds spent on the page |
| `scrollDepthPercent` | number | How far the page was scrolled (0-100) |
| `linksFound` | number | Links found on the page |
| `linksFollowed` | number | Links followed from this page |
| `referrer` | string | Previous page URL (empty for start URLs) |
| `userAgent` | string | User agent used for this visit |
| `viewport` | string | Viewport dimensions (e.g., 1920x1080) |
| `timestamp` | string | ISO 8601 timestamp of the visit |

#### Sample output

```json
{
    "url": "https://example.com/",
    "status": "success",
    "pageTitle": "Example Domain",
    "loadTimeMs": 342,
    "timeOnPageSec": 28.5,
    "scrollDepthPercent": 85,
    "linksFound": 1,
    "linksFollowed": 0,
    "referrer": "",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
    "viewport": "1920x1080",
    "timestamp": "2026-03-23T10:30:00.000000+00:00"
}
```

### How it works

1. Launches a real Chromium browser with stealth technology to avoid bot detection
2. Creates a unique browser fingerprint for each start URL (user agent, viewport, timezone, WebGL)
3. Visits each target URL and simulates human behavior: scrolling, mouse movements, link hovering
4. Spends the configured amount of time on each page with natural variation
5. Optionally follows links to simulate deeper browsing sessions
6. Records detailed metrics for every page visited
7. Stops automatically when the kill switch timer expires

### Tips for best results

- Start with a small number of URLs and short `endAfterSeconds` to test
- Use PAGEVIEW mode for realistic traffic; STRESS mode for load testing only
- Enable crawling to increase total page visits per start URL
- Adjust `waitOnPage` based on your needs: 10-30s for quick traffic, 60-120s for deep engagement
- Use proxy for websites that block datacenter IPs or for traffic from specific locations
- YouTube mode works best with `waitOnPage` set to the approximate video duration
- Block additional resources to speed up page loads when images and scripts are not needed

### Limitations

- The actor uses a real browser, so it consumes more compute than HTTP-only tools
- Some websites with advanced bot detection may still block visits
- YouTube view counting has anti-fraud systems; views may not always register in YouTube analytics
- Stress mode may trigger rate limiting on target websites
- The actor cannot solve CAPTCHAs

### Frequently Asked Questions

**Do I need a proxy?**
No. The actor works without proxy for most websites. Use proxy when target websites block datacenter IPs or when you need traffic from specific geographic locations.

**How many pages can it visit?**
In PAGEVIEW mode with 30-second dwell time, approximately 2 pages per minute per start URL. With crawling enabled and 10 maxPagesPerUrl, one start URL generates up to 10 page visits. In STRESS mode, it can process 50+ pages per minute.

**Does it work with YouTube?**
Yes. Enable the YouTube mode and set `waitOnPage` to the desired viewing duration. The actor plays the video and simulates watching behavior.

**Can I use it for Etsy?**
Yes. Provide your Etsy shop or listing URL as a start URL. Enable crawling to visit multiple product pages.

**What is the kill switch?**
The `endAfterSeconds` parameter automatically stops the actor after the specified time. This prevents runaway costs. Set to 0 for unlimited runtime (the actor will stop after processing all URLs).

**Does it store output data?**
Yes. Every page visit is recorded in the dataset with detailed metrics including load time, scroll depth, and interaction data.

**How is the human behavior simulated?**
Each visit includes random mouse movements, variable-speed scrolling to random depths, link hovering, and idle periods that simulate reading. Timing varies randomly so no two visits look identical.

**Can it follow links on the target website?**
Yes. Enable crawling mode to follow links on visited pages. You can specify a CSS selector to target specific links (e.g., `a.product-link`). Only same-domain links are followed.

**What is the difference between PAGEVIEW and STRESS mode?**
PAGEVIEW mode simulates realistic human browsing with scrolling, mouse movements, and dwell time. STRESS mode sends rapid requests with minimal delay, useful for load testing your own websites.

**Can I run multiple instances?**
Yes. You can start multiple runs of this actor simultaneously from the Apify platform to multiply traffic volume.

# Actor input Schema

## `startUrls` (type: `array`):

URLs to visit. Supports any website, YouTube videos, Etsy shops, Behance profiles, and more.

## `mode` (type: `string`):

PAGEVIEW simulates normal browsing with human-like behavior. STRESS sends rapid requests without delays.

## `enableCrawling` (type: `boolean`):

When enabled, follows links on visited pages to simulate deeper browsing sessions. Only same-domain links are followed.

## `crawlingLinkSelector` (type: `string`):

CSS selector for links to follow when crawling is enabled. Example: 'a.product-link' to follow only product links.

## `maxPagesPerUrl` (type: `integer`):

Maximum number of pages to visit per start URL when crawling is enabled.

## `waitOnPage` (type: `integer`):

Seconds to spend on each page simulating human behavior. Actual time varies ±20% for realism. Set to 0 for minimum dwell time.

## `endAfterSeconds` (type: `integer`):

Automatically stop the actor after this many seconds. Set to 0 for unlimited runtime (runs until all URLs are processed).

## `enableYoutube` (type: `boolean`):

YouTube URLs trigger video playback simulation: auto-plays videos, waits for configured duration, and handles cookie consent.

## `blockResources` (type: `array`):

Additional URL patterns to block for faster page loads. Common ad and tracking URLs are blocked by default. Not applied on YouTube pages.

## `enableAdvancedFingerprinting` (type: `boolean`):

Randomize browser fingerprint for each session: user agent, viewport, locale, timezone, and WebGL. Makes each visit appear from a different device.

## `proxyConfiguration` (type: `object`):

Optional proxy settings. The actor works without proxy for most websites. Use proxy for sites that block datacenter IPs or for geographic targeting.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://example.com/"
    }
  ],
  "mode": "PAGEVIEW",
  "enableCrawling": false,
  "crawlingLinkSelector": "a[href]",
  "maxPagesPerUrl": 10,
  "waitOnPage": 30,
  "endAfterSeconds": 300,
  "enableYoutube": false,
  "enableAdvancedFingerprinting": true
}
```

# Actor output Schema

## `visits` (type: `string`):

Dataset containing all visited page records with metrics

# 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 = {
    "startUrls": [
        {
            "url": "https://example.com/"
        }
    ],
    "maxPagesPerUrl": 10,
    "waitOnPage": 30,
    "endAfterSeconds": 300
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/traffic-generator").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 = {
    "startUrls": [{ "url": "https://example.com/" }],
    "maxPagesPerUrl": 10,
    "waitOnPage": 30,
    "endAfterSeconds": 300,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/traffic-generator").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 '{
  "startUrls": [
    {
      "url": "https://example.com/"
    }
  ],
  "maxPagesPerUrl": 10,
  "waitOnPage": 30,
  "endAfterSeconds": 300
}' |
apify call crawlerbros/traffic-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crawlerbros/traffic-generator"
        }
    }
}

```

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/jQJDalFGvR2b87kf0/builds/cl3b8rMcvfynUn32l/openapi.json
