# Campaign URL & UTM Integrity Checker (`afkdigital/campaign-url-utm-integrity-checker`) Actor

Bulk campaign link QA: audit HTTP redirects, missing or changed UTMs, naming rules and final domains. Export JSON/CSV. No ad login.

- **URL**: https://apify.com/afkdigital/campaign-url-utm-integrity-checker.md
- **Developed by:** [AFK Digital](https://apify.com/afkdigital) (community)
- **Categories:** Marketing, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$8.00 / 1,000 completed unique url audits

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

## Campaign URL & UTM Integrity Checker

Audit campaign links before a launch or during a campaign QA review. Check HTTP responses, follow redirect chains and identify UTM parameters that disappear or change. No advertising account login, browser session, paid proxy or external paid data service is required.

### What you get

- Original and final URL, HTTP status and every HTTP redirect hop.
- Required UTM fields missing or empty at the last reached URL.
- Per-hop UTM changes, including removed, added and changed values.
- Separate evidence for empty values, repeated keys, noncanonical key case and malformed percent/UTF-8 encoding.
- Naming violations and an exact final-domain allowlist decision.
- Distinct timeout, DNS, TLS, access-blocked, redirect-loop, redirect-limit, invalid-URL and blocked-address outcomes.
- JSON and CSV exports from the run's Dataset.

HTTP success does **not** prove conversion tracking works. This Actor does not execute pixels, consent tools, JavaScript, meta-refresh redirects, analytics events or purchase flows. It reports the HTTP behavior observed from Apify's network at the time of the run. Bot protection, geography and cookies may change the result.

### Quick start

Run the prefilled test-service URLs first. They demonstrate a redirect preserving UTMs, a redirect dropping UTMs and a 404. No real advertising click tracker is used by default. Actual customer campaign links can record a click when requested.

Provide `urls` as a list of URL strings, or `csvFile` as a publicly reachable HTTP(S) UTF-8 CSV URL with a `url` column. You can use both; they are combined and deduplicated. CSV files are limited to 2 MiB and 10,000 data rows.

```json
{
  "urls": ["https://httpbingo.org/get?utm_source=newsletter&utm_medium=email&utm_campaign=launch"],
  "requiredUtmFields": ["utm_source", "utm_medium", "utm_campaign"],
  "namingRules": {"utm_source": {"case": "lower", "noWhitespace": true}},
  "allowedFinalDomains": ["httpbingo.org"],
  "maxRedirects": 8,
  "timeoutSeconds": 15,
  "maxUrls": 100
}
```

### UTM rules

Keys are case-sensitive: `UTM_source` is reported as a case variant and does not satisfy `utm_source`. Values are decoded once using URL query semantics: `+` and `%20` both mean a space. Values remain case-sensitive. Invalid percent encoding and invalid UTF-8 are flagged separately.

Repeated keys remain ordered lists. A change in multiplicity or order is reported. For required fields, at least one non-whitespace value satisfies presence; blank duplicates are still listed in `empty_utms`. Malformed encoding is flagged even if a decoded replacement value satisfies presence. Changes are recorded at each hop, so a removed parameter restored later remains visible. Raw URLs in the chain preserve evidence of encoding-only changes; equivalent decoded values are not classified as changed.

`namingRules` maps UTM fields to `case` (any/lower/upper), `allowedValues` (string list), `noWhitespace` (boolean), and `separator` (any/underscore/hyphen; rejects the opposite separator). Rules apply to final values; initial details are also included. Arbitrary regex is not supported.

`allowedFinalDomains` uses exact, case-insensitive hostname matching, without wildcard or automatic subdomain inclusion. Empty means `not_configured`. On an incomplete redirect chain, `final_url` is the last URL that actually returned an HTTP response, not a verified final destination; use `check_status` to distinguish this.

### Limits and security

Only public HTTP(S) destinations on ports 80 and 443 are supported. Local, private, link-local, metadata, multicast and special-use IP addresses are blocked, including unsafe DNS answers, IP literals and transition addresses. Every redirect is checked. DNS addresses are filtered in the resolver used by the actual socket connector, preventing a separate unvalidated DNS lookup.

Four URLs run concurrently. Requests to one hostname are serialized and spaced at least 500 ms apart. `timeoutSeconds` is a total per-URL deadline including DNS, rate waiting and all redirects (1–60 seconds). `maxRedirects` is 0–20 and `maxUrls` is 1–10,000, default 100. Long queues on the same host can therefore time out with a small deadline.

Response bodies are not needed and are closed immediately after headers. Aggregate headers are capped at 64 KiB before parsing, with an additional per-connection received-byte ceiling of 2 MiB plus 64 KiB; automatic decompression, environment proxies and cookies are disabled. CSV downloads have a strict 2 MiB ceiling; blank or missing URL cells are skipped. No credentials are forwarded and no network retries are performed.

Duplicate identity removes fragments, lowercases scheme/host and normalizes an empty path to slash; query order, key case and values remain distinct. `maxUrls` applies after deduplication. Supply only links you are authorized to test. URLs and their query strings are included in Dataset results, so avoid embedding secrets.

### Pricing

**$0.008 per successfully completed unique URL audit ($8 per 1,000).** One custom `url-checked` event per completed unique URL per run. Platform usage is included; no Actor-start or automatic Dataset-item charge is configured.

A final 404, 410 or 5xx response is a completed, useful finding and is billable. Missing UTMs, changed parameters and a disallowed final domain are also completed findings. HTTP 401, 403, 407 and 429 are classified as access blocked and are not billed. Timeouts, DNS/TLS/network errors, invalid URLs, blocked addresses and incomplete redirect chains are not billed. Actor errors and duplicate/retried work are not billing events. Starting a separate fresh run requests a new audit.

Results are saved before billing. Persistent processed markers prevent charging the same URL again when a run restarts; an ambiguous crash can cause undercharging rather than duplicate billing. Spending limits are respected using the current fixed event price.

### Output

Required columns: `input_url`, `final_url`, `http_status`, `redirect_chain`, `missing_utms`, `changed_utms`, `naming_violations`, `final_domain_status`, `check_status`. Additional fields include `billable`, initial/final UTM details and an error explanation when applicable. Nested evidence is most convenient in JSON; CSV export contains the same Dataset records.

### Support and version

Version 1.0.0. Use the Issues tab on this Actor's Store page for reproducible problems. Include a sanitized URL, input settings, run ID and expected HTTP behavior. Do not share credentials.

Built with Apify SDK (Apache-2.0), aiohttp (Apache-2.0) and Python (PSF license). Dependency versions are pinned in the release requirements.

# Actor input Schema

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

HTTP(S) URLs. Duplicates are checked once per run. Real ad links may record clicks; default examples use a test service.

## `csvFile` (type: `string`):

Public HTTP(S) UTF-8 CSV with a url header. Maximum 2 MiB and 10000 rows. Same SSRF protection as campaign URLs.

## `requiredUtmFields` (type: `array`):

Exact lowercase UTM names. Missing and blank values are reported.

## `namingRules` (type: `object`):

Map utm field names to rules: case any/lower/upper; allowedValues string array; noWhitespace boolean; separator any/underscore/hyphen. Example: {"utm_source":{"case":"lower","noWhitespace":true}}. No regex.

## `allowedFinalDomains` (type: `array`):

Exact hostname allowlist, no wildcard or subdomain expansion. Empty disables domain policy.

## `maxRedirects` (type: `integer`):

Allowed range 0–20.

## `timeoutSeconds` (type: `integer`):

Allowed range 1–60.

## `maxUrls` (type: `integer`):

Allowed range 1–10000.

## Actor input object example

```json
{
  "urls": [
    "https://httpbingo.org/redirect-to?url=https%3A%2F%2Fhttpbingo.org%2Fget%3Futm_source%3Ddemo%26utm_medium%3Dtest%26utm_campaign%3Dlaunch&utm_source=demo&utm_medium=test&utm_campaign=launch",
    "https://httpbingo.org/redirect-to?url=%2Fget&utm_source=demo&utm_medium=test&utm_campaign=launch",
    "https://httpbingo.org/status/404?utm_source=demo&utm_medium=test&utm_campaign=launch"
  ],
  "requiredUtmFields": [
    "utm_source",
    "utm_medium",
    "utm_campaign"
  ],
  "namingRules": {},
  "allowedFinalDomains": [],
  "maxRedirects": 8,
  "timeoutSeconds": 15,
  "maxUrls": 100
}
```

# Actor output Schema

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

No description

## `csv` (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 = {
    "urls": [
        "https://httpbingo.org/redirect-to?url=https%3A%2F%2Fhttpbingo.org%2Fget%3Futm_source%3Ddemo%26utm_medium%3Dtest%26utm_campaign%3Dlaunch&utm_source=demo&utm_medium=test&utm_campaign=launch",
        "https://httpbingo.org/redirect-to?url=%2Fget&utm_source=demo&utm_medium=test&utm_campaign=launch",
        "https://httpbingo.org/status/404?utm_source=demo&utm_medium=test&utm_campaign=launch"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("afkdigital/campaign-url-utm-integrity-checker").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 = { "urls": [
        "https://httpbingo.org/redirect-to?url=https%3A%2F%2Fhttpbingo.org%2Fget%3Futm_source%3Ddemo%26utm_medium%3Dtest%26utm_campaign%3Dlaunch&utm_source=demo&utm_medium=test&utm_campaign=launch",
        "https://httpbingo.org/redirect-to?url=%2Fget&utm_source=demo&utm_medium=test&utm_campaign=launch",
        "https://httpbingo.org/status/404?utm_source=demo&utm_medium=test&utm_campaign=launch",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("afkdigital/campaign-url-utm-integrity-checker").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 '{
  "urls": [
    "https://httpbingo.org/redirect-to?url=https%3A%2F%2Fhttpbingo.org%2Fget%3Futm_source%3Ddemo%26utm_medium%3Dtest%26utm_campaign%3Dlaunch&utm_source=demo&utm_medium=test&utm_campaign=launch",
    "https://httpbingo.org/redirect-to?url=%2Fget&utm_source=demo&utm_medium=test&utm_campaign=launch",
    "https://httpbingo.org/status/404?utm_source=demo&utm_medium=test&utm_campaign=launch"
  ]
}' |
apify call afkdigital/campaign-url-utm-integrity-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,afkdigital/campaign-url-utm-integrity-checker"
        }
    }
}
```

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/0FXI26qpc9H7dX19s/builds/7zelMwmEfeeBN5yFW/openapi.json
