How to Use the Dark Traffic Attribution Builder
Generate a JavaScript snippet that attributes traffic from private messaging apps, email shares, and other "dark social" sources that Google Analytics cannot track.
Step 1: Enter your website URL and the page path you want to track.
Step 2: Optionally add a campaign tag for internal reference.
Step 3: Click "Generate Dark-Traffic Link" to get a tracking URL and an attribution script. The script uses localStorage to record visit context without third-party cookies.
Dark Social: The 70% of Your Traffic You Cannot See
When someone shares your article via WhatsApp, iMessage, Signal, email, or a private Slack channel, the recipient clicks the link and arrives at your site. But because there is no referrer header (these apps strip it for privacy), Google Analytics categorizes this visit as "Direct" traffic. You have no idea where it came from. This is "dark social" traffic, and in 2026 it accounts for an estimated 70% of all content sharing.
Why Dark Traffic Matters
If you cannot see where your traffic comes from, you cannot optimize for it. A blogger might assume their traffic is mostly from Google search and invest heavily in SEO, when in reality 50% of their visits come from WhatsApp group shares. If they knew this, they might optimize their content for shareability (shorter paragraphs, compelling opening lines, mobile-friendly formatting) rather than keyword density. Dark traffic attribution gives you visibility into the sharing patterns that actually drive your audience.
How the Script Works
The attribution script runs when a visitor lands on your page. It records the referrer (if any), viewport size, language, touch capability, platform, and timestamp. This data is stored in the visitor's localStorage under a key derived from the page path. On subsequent visits, the script updates the stored record with visit count and last-visit timestamp. Because all data is stored locally, no third-party cookies are needed and no external services are contacted. You can extend the script to send data to your own analytics endpoint using navigator.sendBeacon().
Frequently Asked Questions
No. It complements GA by tracking the traffic that GA cannot see. Use GA for overall traffic analysis and this script for dark social attribution. The localStorage data can be exported and merged with your GA data for a more complete picture.
The script stores non-personal data (page path, visit count, timestamps) in the user's own browser via localStorage. No data is transmitted to external servers by default. This is generally considered less invasive than third-party cookies. However, if you extend the script to send data to your own endpoint, you must ensure compliance with applicable data protection regulations including GDPR consent requirements.
Yes. The campaign tag you enter is appended as a URL fragment (hash). It is included in the tracking data and can be used to segment dark traffic by campaign. Use consistent naming conventions (newsletter-jan2026, whatsapp-share, email-sig) to make analysis easier.