# NEW Web Traffic Generator (YouTube, Vimeo, Twitch...) (`arlusm/website-traffic-generator`) Actor

Powerful tool for simulating realistic traffic to your websites, YouTube videos, Etsy stores, etc. It mimics user behavior by visiting pages, waiting, and optionally crawling subpages. It can evade detection and provide traffic from specific regions, enhancing your SEO and analytics performance.  ´

- **URL**: https://apify.com/arlusm/website-traffic-generator.md
- **Developed by:** [Aluslabs](https://apify.com/arlusm) (community)
- **Categories:** Automation, SEO tools
- **Stats:** 256 total users, 2 monthly users, 100.0% runs succeeded, 9 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## 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

## Traffic Generator Actor

The **Traffic Generator Actor** is a powerful tool designed to simulate user traffic on target URLs, including YouTube videos. By opening the specified URLs in a browser, it mimics user behavior to generate page views, helping enhance visibility, test website stability, and measure site performance.

***

### Features

- **Simulated Page Views**: Generate realistic visits to your target URLs.
- **Optional Proxy Support**: Use residential proxies to evade detection and mimic traffic from different geographic regions. Note: Residential proxies can be costly.
- **Crawling Capability**: Optionally crawl subpages of the target URLs to extend traffic generation.
- **Resource Blocking**: Optimize performance by blocking unnecessary resources such as images and scripts.

***

### How It Works

1. The actor navigates to the provided URLs using a browser.
2. It waits on the page for a specified duration (default: 60 seconds).
3. If crawling is enabled, the actor identifies and visits links within the page based on a CSS selector.
4. When using residential proxies, the traffic can evade detection, appearing more legitimate to the target site.

***

### Input Parameters

The actor accepts the following input configuration:

#### Input Schema

```json
{
    "startUrls": [
        {
            "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"
        }
    ],
    "useProxy": true,
    "proxyCountryCode": "US",
    "enableCrawling": false,
    "crawlingLinkSelector": "a",
    "blockUrlPatterns": [],
    "waitOnPage": 60,
    "endAfterSeconds": 600
}
```

#### Parameters Explained

- **`startUrls`** (Required): List of URLs to simulate traffic on.
- **`useProxy`** (Optional, Default: `true`): Enable or disable the use of residential proxies. If `false`, requests will use a direct connection.
- **`proxyCountryCode`** (Optional, Default: `"US"`): Two-letter country code for proxy usage. Ignored if `useProxy` is `false`.
- **`enableCrawling`** (Optional, Default: `false`): Set to `true` to enable crawling of links on the target page.
- **`crawlingLinkSelector`** (Optional, Default: `"a"`): CSS selector to identify links for crawling. Only used if `enableCrawling` is enabled.
- **`blockUrlPatterns`** (Optional, Default: `[]`): Array of URL patterns to block during traffic generation (e.g., `[".jpg", ".css"]`).
- **`waitOnPage`** (Optional, Default: `60`): Time in seconds to stay on each page.
- **`endAfterSeconds`** (Optional, Default: `600`): Maximum time in seconds for the actor to run before stopping.

***

### Notes on Proxies

- **Residential Proxies**: If `useProxy` is enabled, the actor uses residential proxies, which are harder to detect and block, providing more realistic traffic simulation. However, they can incur higher costs.
- **Direct Connection**: If `useProxy` is disabled, the actor uses a direct connection, which is free but easier to detect and block.

***

### Example Usage

#### Generate Views for YouTube Videos

To generate views for a YouTube video, use the following input:

```json
{
    "startUrls": [
        {
            "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"
        }
    ],
    "useProxy": true,
    "proxyCountryCode": "US",
    "waitOnPage": 120,
    "endAfterSeconds": 1200
}
```

This configuration:

- Generates views for the specified YouTube video.
- Simulates 10 views by waiting 120 seconds per view and running for 1200 seconds.

#### Generate Traffic Without Proxies

To generate traffic without using residential proxies:

```json
{
    "startUrls": [
        {
            "url": "https://www.example.com"
        }
    ],
    "useProxy": false,
    "waitOnPage": 60,
    "endAfterSeconds": 300
}
```

This configuration simulates traffic directly without proxies.

***

### Running the Actor

#### On Apify Platform

1. Deploy the actor to Apify.
2. Configure the input as described above.
3. Start the actor and monitor its progress via the logs.

***

### Output

The actor logs detailed messages about:

- Navigation to each URL.
- Time spent on the page.
- Crawling activity (if enabled).
- Proxy configuration used (if applicable).

Monitor the effectiveness of the traffic generation directly through your analytics dashboard or tracking tools.

***

### Important Notes

- **Proxy Costs**: Using residential proxies significantly improves the quality of traffic but comes with higher costs. Plan usage accordingly.
- **Actor Timeout**: Ensure the `endAfterSeconds` parameter is set appropriately to control the actor's runtime and cost.

# Actor input Schema

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

List of URLs to generate traffic for.

## `useProxy` (type: `boolean`):

Enable or disable the use of residential proxies.

## `proxyCountryCode` (type: `string`):

Specify the two-letter country code for remote proxies.

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

Specify how long (in seconds) the actor should stay on each page.

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

Enable crawling of subpages and links within the target pages.

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

CSS selector for extracting links to crawl. This is used only when crawling is enabled.

## `blockUrlPatterns` (type: `array`):

Patterns of URLs to block during traffic generation (e.g., '.jpg', '.css').

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

Maximum time (in seconds) for the actor to run before stopping.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"
    }
  ],
  "useProxy": true,
  "proxyCountryCode": "US",
  "waitOnPage": 60,
  "enableCrawling": false,
  "crawlingLinkSelector": "a",
  "blockUrlPatterns": [],
  "endAfterSeconds": 300
}
```

# 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://www.youtube.com/watch?v=jNQXAC9IVRw"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("arlusm/website-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://www.youtube.com/watch?v=jNQXAC9IVRw" }] }

# Run the Actor and wait for it to finish
run = client.actor("arlusm/website-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://www.youtube.com/watch?v=jNQXAC9IVRw"
    }
  ]
}' |
apify call arlusm/website-traffic-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,arlusm/website-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/ag7AzrzkpfAEbLrTM/builds/NgmeelmbURTbxRO7l/openapi.json
