# GTM Container Audit: tags, IDs and script hosts (`income_wizard/gtm-container-audit`) Actor

Audit any public Google Tag Manager container: live and paused tags, tag types, tracking IDs, linked Google Ads accounts, child containers and third-party script hosts. No browser.

- **URL**: https://apify.com/income_wizard/gtm-container-audit.md
- **Developed by:** [Illia Boyko](https://apify.com/income_wizard) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 container auditeds

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

## GTM Container Audit: what is inside a Google Tag Manager container

Give it Google Tag Manager container IDs (`GTM-XXXX`) or websites, and it reads each container's public `gtm.js` as data and returns an inventory: how many live and paused tags, which tag types, which tracking IDs (GA4, Google Ads, Meta Pixel, TikTok, LinkedIn, Bing UET and more) are configured, which Google Ads accounts are linked, which child containers are nested, and which third-party script hosts the container loads. Plain HTTP, no browser, no proxy, no login, nothing to install in the container. It reads only what Google serves to every visitor of the site.

### Who uses it

- **Agencies and consultants** auditing a client's tag setup before a migration or a privacy review: how many Custom HTML tags, how many paused tags are left behind, which vendors fire.
- **Analysts and marketers** checking which ad platforms and accounts a competitor's container is wired to.
- **Developers** who want a container's contents as JSON.

### Input

```json
{"containers": ["GTM-N5LT88", "GTM-5KGDZGG"], "urls": ["salesforce.com"]}
```

`containers`: GTM IDs. `urls`: websites; every container on the start page is audited. `concurrency`, `maxInputs` limit the run.

### Output (one row per container)

```json
{"container": "GTM-N5LT88", "version": "717", "liveTags": 385, "pausedTags": 6,
 "tagTypes": [{"type": "GA4 event", "count": 73}, {"type": "Custom HTML", "count": 71}],
 "customHtmlTags": 71, "customJsVariables": 31, "variables": 190, "triggersAndRules": 214,
 "ids": [{"tool": "Google Ads", "id": "AW-1059368811", "via": "__awct"}],
 "linkedGoogleAdsAccounts": ["AW-1059368811", "AW-864956254", "AW-984961564"],
 "childContainers": [], "scriptHosts": ["analytics.tiktok.com", "connect.facebook.net", "snap.licdn.com"]}
```

`liveTags` counts every entry GTM stores as a tag, including click listeners and trigger groups. `ids` come from live tags only (paused tags are skipped); `linkedGoogleAdsAccounts` are Ads accounts connected in the container's settings. Container tag types the actor does not know keep GTM's internal name (for example `__qpx`).

### What the tests showed

Run on 36 real containers (found on company sites) plus 5 other inputs (hubspot.com, whose container repeats one already listed, and 4 bad ones): 37 containers audited; with child containers 44 were read. The 4 bad inputs (missing container, not an ID, a site without GTM, not a URL) return a row with a note and are not charged. Of the 44 containers: tag types listed in 44, IDs listed in 43, script hosts in 40, linked Ads accounts in 30, child containers in 4. Every one of the 494 IDs and linked accounts returned exists as text in its container, and the live and paused tag counts match an independent recount, in all 44.

### Price

**$0.01 per container audited.** Missing or private containers, invalid input and sites without GTM are free. The run uses 512 MB of memory; 20 containers took 2.3 s in our test.

### Limits

- Only the published version of a container is visible; drafts and workspaces are not.
- Triggers are not evaluated: an ID in a live tag may fire only on some pages or after consent.
- IDs that a container builds from a runtime variable cannot be read.
- Third-party script hosts come from the URLs written in the container; a host built in code is not listed.

# Actor input Schema

## `containers` (type: `array`):

Container IDs such as GTM-N5LT88, one per line.

## `urls` (type: `array`):

Websites whose start page loads Google Tag Manager; every container found on the page is audited.

## `concurrency` (type: `integer`):

How many containers or websites are fetched at once.

## `maxInputs` (type: `integer`):

Stop after this many containers and websites in total.

## Actor input object example

```json
{
  "containers": [
    "GTM-N5LT88"
  ],
  "concurrency": 5,
  "maxInputs": 500
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "containers": [
        "GTM-N5LT88"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("income_wizard/gtm-container-audit").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 = { "containers": ["GTM-N5LT88"] }

# Run the Actor and wait for it to finish
run = client.actor("income_wizard/gtm-container-audit").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 '{
  "containers": [
    "GTM-N5LT88"
  ]
}' |
apify call income_wizard/gtm-container-audit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,income_wizard/gtm-container-audit"
        }
    }
}
```

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/vzocegxt9MStHZupO/builds/veFHmyy1Nqdz4wI1h/openapi.json
