Loyalty Links
Loyalty Links
Description
Loyalty Links is a WordPress plugin that implements a “give and take” approach to external linking. The plugin tracks which external domains have sent visitors to your site via referrers, and only allows links to those domains to remain functional. Links to domains that haven’t recently referred visitors are “broken” (href changed to “#”) while remaining visible on the page.
Key Features
- Referrer Tracking: Automatically tracks external domains that send visitors to your site
- Dynamic Link Breaking: Links to domains without recent referrers are automatically disabled
- Selective Monitoring: Only monitor specific domains you choose – other external links remain untouched
- Configurable Retention: Set how many days to retain referrer records (default: 30 days)
- Test Mode: Add test domains to verify functionality without waiting for actual referrals
- Cache-Friendly: Uses REST API endpoints for dynamic data, compatible with WP Rocket, WP Fastest Cache, and other caching plugins
- Performance Optimized: Asynchronous script loading and efficient database operations
How It Works
- Track Referrers: When a visitor arrives from an external domain (in your monitored list), JavaScript sends the referrer information to a REST API endpoint which records the domain, timestamp, and increments the visit count
- Approve Domains: Domains that have sent referrers within your retention period are considered “approved”
- Break Links: Links pointing to non-approved domains have their
hrefchanged to#andpointer-events: noneapplied - Real-Time Updates: Approved domains are fetched dynamically via REST API, ensuring cache compatibility
Use Cases
- Encourage reciprocal linking by only allowing functional links to sites that link back to you
- Create a “loyalty” system where sites that send traffic get link benefits
- Test link management strategies without manual intervention
- Maintain link quality by prioritizing domains that drive traffic
Installation
Automatic Installation
- Go to Plugins Add New in your WordPress admin
- Search for “Loyalty Links”
- Click “Install Now” and then “Activate”
Configuration
- Navigate to Settings Loyality Links
- Add domains to monitor (one per line) in the “Domain List” field
- Set “Retention Days” (how long to remember referrers)
- Optionally add test domains to verify functionality
- Click “Save Settings”
Faq
The plugin uses JavaScript to read document.referrer on each page load and sends it to a REST API endpoint via AJAX. If the referrer is from an external domain in your monitored list, the endpoint records the domain, current timestamp, and increments the visit count.
This cache-friendly approach allows your HTML to be fully cached while tracking happens client-side.
The tracking request is sent asynchronously and doesn’t block page rendering, so it won’t slow down your page load times.
Yes! The plugin is designed to be cache-friendly. It uses REST API endpoints to fetch approved domains dynamically, so your HTML can be fully cached while link-breaking logic remains real-time.
Broken links remain visible on the page but:
* Their href attribute is changed to #
* pointer-events: none is applied to prevent interaction
* CSS classes is-broken-link and loyalty-links-broken are added for styling
* The original href is stored in data-original-href attribute
Yes! Use the “Test Domain” field in settings to add domains for testing. Test domains are never approved, so their links will always be broken regardless of retention settings.
No. Internal links (same domain) are never modified. Only external links pointing to domains in your monitored list are processed.
If your monitored domains list is empty, the plugin won’t track any referrers and won’t modify any links. It’s effectively disabled until you add domains to monitor.
The plugin automatically removes the www. prefix and converts domains to lowercase for consistency. Both example.com and www.example.com are treated as the same domain.
The plugin only modifies links to domains in your monitored list. Other external links remain untouched, so it should be compatible with most other plugins. However, test thoroughly if using multiple link-related plugins.
Minimal. The plugin:
* Loads JavaScript asynchronously
* Uses REST API for dynamic data (doesn’t block page rendering)
* Tracks referrers client-side via JavaScript (cache-friendly)
* Runs cleanup on only 1% of requests to avoid performance impact
Reviews
Changelog
1.0.1
- Added “Settings” link on the Plugins page (quick access to Loyalty Links settings)
- Added “Documentation” link on the Plugins page (configuration guide on WordPress.org)
1.0.0
- Initial release
- JavaScript-based referrer tracking via REST API (cache-friendly)
- Visit count tracking for monitored domains
- Dynamic link breaking based on referrer history
- Admin settings page with domain management and visit counts
- Configurable retention period
- Test domain functionality
- REST API endpoints for cache-friendly operation (approved domains and referrer tracking)
- Performance optimizations (async loading, efficient DB operations)
- MutationObserver for dynamic content support