# Website Analytics Detector (`perfection/website-analytics-detector`) Actor

Find out what tracking and analytics tools a website uses

- **URL**: https://apify.com/perfection/website-analytics-detector.md
- **Developed by:** [Per R](https://apify.com/perfection) (community)
- **Categories:** Developer tools, Integrations, Automation
- **Features:** Full permissions
- **Stats:** 58 total users, 1 monthly users, 94.9% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.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

## Tracking Detector

Web analytics and tracking detection tool built with TypeScript and Puppeteer. This Apify actor scans websites to identify various tracking and analytics tools, capturing both static implementations and runtime tracking events.

### Features

- Detects popular analytics and tracking tools
- Captures real-time tracking events
- Identifies script implementations
- Extracts tracking IDs and configuration
- Provides detailed logging of all detected tracking activities
- TypeScript implementation with strong type safety

### Usage

#### Input

The actor accepts a single required parameter:

```json
{
    "url": "https://example.com"
}
```

- `url`: The target website URL to analyze (must be a valid HTTP/HTTPS URL)

#### Output

The actor provides detailed tracking information in the following format:

```typescript
{
    url: string;              // The analyzed URL
    timestamp: string;        // ISO timestamp of analysis
    tools: Array<{
        name: string;         // Name of the tracking tool
        script_urls: string[];  // URLs of detected tracking scripts
        tracking_urls: string[]; // URLs of actual tracking requests
    }>;
}
```

##### Detection Methods

The actor uses two methods to detect tracking tools:

1. **Script Detection** (`script_urls`)
   - Finds tracking scripts loaded on the page
   - Shows what tools are implemented, even if not actively tracking
   - Example: `"script_urls": ["https://analytics.example.com/tracking-script.js"]`

2. **Network Request Detection** (`tracking_urls`)
   - Captures actual tracking requests made to analytics servers
   - Shows real tracking activity and data collection
   - Example: `"tracking_urls": ["https://analytics.example.com/track?data=..."]`

A tool might appear in the results with:

- Both `script_urls` and `tracking_urls` (actively tracking)
- Only `script_urls` (implemented but not yet tracking)
- Only `tracking_urls` (tracking via alternative implementation)

### Detected Services

#### 🔹 Web & Product Analytics

- Google Analytics
- Google Tag Manager
- Mixpanel
- Segment
- Heap
- Amplitude
- Pendo
- PostHog

#### 🔹 Advertising & Conversion Tracking

- Facebook Pixel
- TikTok Pixel
- LinkedIn Insight Tag
- Twitter Conversion Tracking
- Microsoft Clarity
- Pinterest Tag

#### 🔹 A/B Testing & Personalization

- Google Optimize
- Optimizely
- VWO (Visual Website Optimizer)

#### 🔹 Customer Data Platforms (CDPs)

- RudderStack
- mParticle

#### 🔹 Live Chat & Customer Support Tracking

- Intercom
- Drift
- Zendesk Chat
- LiveChat

#### 🔹 Session Recording & Heatmaps

- Hotjar
- Crazy Egg
- FullStory
- Lucky Orange

#### 🔹 Email & Marketing Automation

- Klaviyo
- HubSpot Tracking
- Marketo
- Mailchimp Tracking

#### 🔹 Push Notifications & Engagement

- OneSignal
- Airship

#### 🔹 Ecommerce & Affiliate Tracking

- Google Ads Conversion Tracking
- Shopify Pixel
- Rakuten Affiliate
- CJ Affiliate

#### Error Handling

The actor includes robust error handling for:

- Invalid URL inputs
- Network timeouts
- Page load failures
- Browser crashes
- Runtime errors
- Storage operation failures

### Future Improvements

- Add detection for more analytics platforms
- Add support for cookie analysis
- Enhance tracking event categorization
- Add support for custom tracking patterns
- Implement batch URL processing
- Add support for authentication/login flows

# Actor input Schema

## `url` (type: `string`):

The URL of the website to analyze for tracking and analytics tools.

## Actor input object example

```json
{
  "url": "https://example.com"
}
```

# 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 = {
    "url": "https://example.com"
};

// Run the Actor and wait for it to finish
const run = await client.actor("perfection/website-analytics-detector").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 = { "url": "https://example.com" }

# Run the Actor and wait for it to finish
run = client.actor("perfection/website-analytics-detector").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 '{
  "url": "https://example.com"
}' |
apify call perfection/website-analytics-detector --silent --output-dataset

```

## MCP server setup

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

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/Ult6kQ0eADspZnz73/builds/RXwdwGRBUWORBAlcb/openapi.json
