Recontrack is a command-line tool and Python library designed to extract tracking codes from websites.
It follows redirects, downloads the full HTML content, and scans embedded scripts to identify tracking IDs from popular platforms such as Google Analytics, Facebook Pixel, Google Tag Manager, Hotjar, LinkedIn Insight, and others.
- Follow HTTP redirects to get the final page URL
- Extract tracking codes from HTML and JavaScript
- Detect multiple popular tracking services using regex patterns
- Provide a simple CLI for quick usage
- Python module for integration in your own projects
- Install
virtualenvif necessary:
pip install virtualenv- Create and activate a new virtual environment:
virtualenv recontrack-env
source recontrack-env/bin/activate- Install Recontrack locally (run this command in the project root where
setup.pyis located):
pip install -r requirements.txtAfter installation, use the recontrack/cli.py command:
python3 recontrack/cli.py <url>Example:
python3 recontrack/cli.py https://example.comSample output:
Fetching content from: https://example.com
Final URL after redirects: https://www.example.com
Found tracking codes:
- Google Analytics (UA): UA-12345678-1
- Facebook Pixel: 123456789012345
For help:
python3 recontrack/cli.py -hYou can also use Recontrack programmatically:
Add to your requirements.txt:
# requirements.txt
git+https://github.com/reconurge/recontrack.gitOr install using python:
pip install git+https://github.com/reconurge/recontrack.gitUse in the command line:
recontrack <url>Or import as a module.
from recontrack import TrackingCodeExtractor
extractor = TrackingCodeExtractor("https://example.com")
extractor.fetch()
extractor.extract_codes()
results = extractor.get_results()
for tracking in results:
print(f"{tracking.source}: {tracking.code}")- Python 3.6+
- requests
- beautifulsoup4
These dependencies are automatically installed via pip when you install the package.
- Core code is in the
recontrack/package - CLI script is in
recontrack/cli.py - Tests can be added in a
tests/folder