Skip to content

Repository files navigation

TagScope

CIPython 3.9+License: MITPlaywright

A Playwright-powered site auditor that crawls websites to detect marketing tags, identify technologies, parse dataLayer events, and generate structured reports. Built for marketing operations professionals who need visibility into what is actually firing on a site, not just what should be.

What it detects

CategoryCountExamples
Marketing/analytics tags77GTM, GA4, Facebook Pixel, LinkedIn, TikTok, Adobe, HubSpot, Segment
Technologies50WordPress, Shopify, React, Next.js, Cloudflare, Stripe, Vercel
GA4 event types25purchase, add_to_cart, page_view, generate_lead, form_submit

All detection uses built-in pattern matching against HTML, script sources, meta tags, response headers, and captured network requests. No external services or API keys required.

Quick start

# Clone and install
git clone https://github.com/JerushaGray/TagScope.git
cd TagScope
pip install .# Install the Chromium browser engine (one-time)
playwright install chromium
# Run an audit
tagscope https://example.com

Usage

# Basic crawl (100 pages, depth 3, exports JSON + CSV + HTML)
tagscope https://example.com
# Larger crawl with higher concurrency
tagscope https://example.com --max-pages 500 --concurrent 5
# LLM-optimized output (compact JSON, strips internals, merges GA4 data)
tagscope https://example.com --format llm
# All formats at once
tagscope https://example.com --format all
# Filter URLs
tagscope https://example.com --exclude "/admin.*""/login.*"# Use a config file for repeatable settings
tagscope https://example.com --config config.yaml
# Also works as a module
python -m tagscope https://example.com

Python API

TagScope exposes a single-page audit function for use in scripts, notebooks, and agents:

importasynciofromtagscopeimportaudit_page, format_page_llm, format_site_llm# Audit a single pageresult=asyncio.run(audit_page("https://example.com"))
# Full result dict: tags, technologies, dataLayer, GA4 events, performanceprint(result["tags_detected"])
# Compact projection for LLM consumptioncompact=format_page_llm(result)

For multi-page audits, use SiteAuditor directly:

fromtagscope.auditorimportSiteAuditorasyncdefrun():
auditor=SiteAuditor({"crawl": {"max_pages": 50}})
awaitauditor.crawl("https://example.com")
auditor.export_findings()
returnformat_site_llm(auditor)

Output

Each crawl creates a run directory at output/run-{domain}/ containing:

FileContents
site-audit-{domain}.jsonFull crawl data: tags, technologies, dataLayer, GA4 collect events, performance, network requests
site-audit-{domain}-findings.jsonComputed analysis: tag index, technology index, coverage profiles, GA4 summary, and auto-generated findings with severity ratings
site-audit-{domain}-tag-matrix.csvTag coverage matrix -- pages as rows, tags as columns, with group deduplication
site-audit-{domain}-llm.jsonCompact projection for LLM consumption: flattened metadata, merged GA4 data, internals stripped
site-audit-{domain}.csvOne row per page with tag presence, load time, link counts
site-audit-{domain}.htmlInteractive dashboard with tag/tech summaries, broken links, page details

Auto-generated findings

The findings report detects 17 issue types automatically, including coverage gaps, UA/GA4 dual-fire, silent GA4 pages, missing consent management, vendor redundancy, duplicate titles, missing metadata, slow pages, dead-end pages, and programmatic ad vendor exposure. Each finding includes a type, severity (high/medium/low), and detail string.

Narrative report (optional)

If you use Claude Code, the bundled /audit-report skill reads the crawl JSON and produces a client-ready markdown report:

/audit-report output/run-example.com/site-audit-example_com.json --tier 3
TierContentLength
Tier 1Factual summary -- reformats data into tables~500 words
Tier 2Analytical -- flags anomalies, identifies patterns (default)~1000-1500 words
Tier 3Advisory -- expands each finding into Finding / Risk / Recommendation / Priority~2000 words

See docs/PIPELINE.md for a full walkthrough of the data pipeline.

MCP server

TagScope ships an MCP server that exposes its auditing tools to AI agents:

pip install "tagscope[mcp]"

Six tools are available: audit_page_tool, start_site_audit, get_audit_status, get_audit_results, list_patterns, and identify_unknowns. The server uses stdio transport and maintains a persistent browser across tool calls.

How it works

URL --> Playwright (Chromium, headless)
|
|--> Intercept all third-party network requests
|--> Extract script tags, meta tags, response headers
|--> Match against 77 tag patterns (regex + URL signatures + network hosts)
|--> Match against 50+ technology patterns (HTML, meta, headers, network)
|--> Parse dataLayer for GA4/ecommerce/gtag events
|--> Decode GA4 Measurement Protocol collect requests
|--> Capture performance metrics (load time, FCP, DOM timings)
|--> Extract internal links --> queue for next depth level
|
|--> Concurrent page processing (configurable, 1-10 pages)
|--> Retry with backoff on timeouts and server errors
|--> Periodic flush to disk for memory management
|--> Resume capability via state files
|
v
output/run-{domain}/
|--> Raw JSON + CSV + HTML exports
|--> Findings report (computed analysis + auto-findings)
|--> Tag coverage matrix
|--> LLM-optimized JSON
|--> [optional] Narrative report via /audit-report skill

Project structure

src/tagscope/
__init__.py Package exports: audit_page, format_page_llm, format_site_llm
__main__.py python -m tagscope entry point
auditor.py SiteAuditor class: crawling, detection, export
cli.py Argument parsing, config loading, entry point
patterns.py Tag patterns, technology patterns, GA4 event map
mcp_server.py MCP server with 6 auditing tools
wappalyzer_adapter.py Wappalyzer fingerprint conversion and caching
config.yaml Default configuration template
tests/ 333 tests (pytest)
docs/
PIPELINE.md Full pipeline walkthrough
DATA_DICTIONARY.md Field definitions for patterns, detection output, and export schema
ARCHITECTURE.md System architecture
CONTRIBUTING.md Development guidelines
ROADMAP.md Planned enhancements

Configuration

Copy and edit config.yaml to customize crawl behavior. Key settings:

crawl:
max_pages: 100# Page limitmax_depth: 3# Link-follow depthrate_limit: 1.0# Seconds between requestsconcurrent_pages: 3# Parallel page limit (1-10)filters:
exclude_patterns: ["/admin.*", "/api/.*"]skip_extensions: [".pdf", ".jpg", ".png", ".zip"]output:
formats: ["json", "csv", "html"]prefix: "output/site-audit"resume:
enabled: true # Resume interrupted crawls

All settings can also be overridden via CLI flags. See tagscope --help.

Extended technology detection

By default TagScope ships 50 curated technology patterns. For broader coverage (~5000 technologies), you can opt in to fingerprints from the Wappalyzer open-source project:

# One-time: download fingerprints to ~/.tagscope/rulesets/
tagscope --fetch-rulesets
# Use them on your next crawl
tagscope https://example.com --extended

This is opt-in because the Wappalyzer fingerprint data is GPL-3.0 licensed. TagScope (MIT) never bundles or redistributes that data -- --fetch-rulesets downloads it to your local machine only. The 50 curated patterns always take precedence when both sources define the same technology.

Comparison

FeatureTagScopeScreaming FrogLighthousepython-seo-analyzer
Marketing tag detection (77 tools)YesNoNoNo
Technology fingerprinting (50 curated, ~5000 extended)YesLimitedNoNo
DataLayer/GA4 event parsingYesNoNoNo
GA4 Measurement Protocol decodingYesNoNoNo
Auto-generated findings (17 types)YesNoNoNo
LLM-optimized output formatYesNoNoNo
Python API (audit_page)YesNoNoNo
MCP server (AI agent integration)YesNoNoNo
JavaScript-rendered pagesYes (Playwright)YesYesNo
Performance metricsYesYesYesNo
Concurrent crawlingYes (1-10 pages)YesSingle pageYes
Resume interrupted crawlsYesNoN/ANo
Interactive HTML reportYesYesYesYes
Free/open sourceYes (MIT)Free tier limitedYesYes
No external dependenciesYesN/ARequires ChromeYes

Requirements

  • Python 3.9+
  • Playwright (installed automatically via pip)
  • Chromium browser engine (playwright install chromium)

License

MIT

Author

Jerusha Gray -- Marketing technologist and software engineer. LinkedIn | GitHub

About

Open-source site auditor that detects marketing tags, dataLayers, GA4 events, and technologies from the network up, and surfaces the third-party calls it can't yet identify, with evidence for each detection.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages