npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

shadow-track

v1.0.0

Published

Make Matomo/Piwik analytics undetectable by ad blockers through parameter encryption

Readme

Shadow Track

Make Matomo/Piwik analytics undetectable by ad blockers through parameter encryption and endpoint obfuscation.

How it works

Shadow Track protects your Matomo analytics from being blocked by:

  1. Endpoint Obfuscation: Renames tracking endpoints to innocent-looking names
  2. Parameter Encryption: Encrypts all tracking parameters into a single obfuscated parameter
  3. Pattern Breaking: Removes recognizable Matomo/Piwik parameter patterns that ad blockers detect

Instead of sending:

POST /matomo.php?idsite=1&rec=1&action_name=Home&url=https://example.com

Shadow Track sends:

POST /waschbaerenparadies?d=a7x9k2FibGUiLCJjb2RlX25hbWUiOiJIb21lIn0=k9x7a

Installation

npm install -g /root/shadow-track

Or run directly:

cd /root/shadow-track
npm install
./cli.js --help

Usage

Quick Setup (Recommended)

Run the complete setup with one command:

shadow-track full-setup \
  --domain analytics.example.com \
  --path /var/www/matomo \
  --js-endpoint tracker.js \
  --tracking-endpoint analytics \
  --secret your-secret-key-2024

Manual Setup

1. Generate Nginx Configuration

shadow-track nginx \
  --domain analytics.example.com \
  --path /var/www/matomo \
  --js-endpoint tracker.js \
  --tracking-endpoint analytics \
  --output /etc/nginx/sites-available/matomo-shadow.conf

2. Patch matomo.js

shadow-track patch-js \
  --input /var/www/matomo/matomo.js \
  --tracking-endpoint analytics \
  --secret your-secret-key-2024

3. Patch matomo.php

shadow-track patch-php \
  --input /var/www/matomo/matomo.php \
  --secret your-secret-key-2024

4. Enable and reload services

# Enable nginx config
ln -s /etc/nginx/sites-available/matomo-shadow.conf /etc/nginx/sites-enabled/

# Test and reload nginx
nginx -t
systemctl reload nginx

# Restart PHP-FPM to clear opcache
systemctl restart php8.2-fpm

Configuration Options

Endpoint Names

  • --js-endpoint: Name for the JavaScript file (default: loewenzahntiger.js)
  • --tracking-endpoint: Name for the tracking endpoint (default: waschbaerenparadies)

Choose innocent-looking names that don't contain words like:

  • track, analytics, matomo, piwik, stats, metrics, telemetry

Secret Key

  • --secret: Encryption key (default: shadow-track-secret-2024)

⚠️ Important: Use the same secret key for both JS and PHP patching!

Update Tracking Code

After setup, update your website's tracking code:

<!-- Before -->
<script src="https://analytics.example.com/matomo.js"></script>

<!-- After -->
<script src="https://analytics.example.com/tracker.js"></script>

Testing

  1. Check if the obfuscated JS loads:
curl https://analytics.example.com/tracker.js
  1. Test tracking endpoint:
curl -X POST "https://analytics.example.com/analytics?d=test"
  1. Monitor nginx logs:
tail -f /var/log/nginx/analytics.example.com.matomo.access.log

Troubleshooting

404 Errors

  • Check nginx configuration is loaded: nginx -T | grep shadow
  • Verify file paths in nginx config
  • Check PHP-FPM socket path

Tracking not working

  • Clear browser cache
  • Check browser console for errors
  • Verify same secret key used for JS and PHP
  • Restart PHP-FPM: systemctl restart php8.2-fpm

Still blocked by ad blockers

  • Try different endpoint names
  • Avoid patterns like sequential numbers or common words
  • Consider using subdomains instead of paths

Security Notes

  • Keep your secret key private
  • Use HTTPS only
  • Regularly rotate endpoint names if they get detected
  • Monitor access logs for suspicious activity

License

MIT