=== Clerqs Traffic Exchange ===
Requires PHP: 7.4
Stable tag: 0.1.13

Clerqs Traffic Exchange is an invite-only WordPress pilot for showing partner RSS posts, comparing widget placements, and working toward a one-for-one trade.

New installs and upgrades include USA Journal and Raw Dog Sports as preconfigured starter trades. Each starts off until enabled in Partners. Existing partnerships are preserved, and a site does not list itself. Each starter trade still needs the same private invite key saved on both sites before posts can appear. Use Pause to turn an active trade off.

== Set up a trade ==

The How To tab in Traffic Exchange walks through setup, widget placement, reports, and troubleshooting.

In Partners, assign each domain one rating: SFW or NSFW. The site-wide Widget content mode defaults to SFW only. Choosing NSFW only excludes SFW partners from every widget. Existing partners and starter trades default to NSFW and stay out of widgets until their rating is confirmed. Changing the content mode or rating preserves trade history. Clear full-page caches after changing the content mode or domain ratings so previously cached widgets refresh.

1. Install and activate the plugin on two public HTTPS WordPress sites.
2. On site A, open Traffic Exchange > Partners. Enter site B's WordPress home URL and an RSS or Atom feed on that origin. Leave the key empty to generate it, and save.
3. Show the invite key and share it privately with site B's admin, along with site A's home and feed URLs. The other admin enters those details and the same key under Partners.
4. Use Sync now on site A to complete the connection. Both partner rows should show Approved · Active. Hourly WordPress cron checks the connection and refreshes peer statistics. A connection with no successful sync for two hours is treated as inactive.
5. Open Widgets. Save a layout and select any categories you want to show. Place it with the Clerqs Traffic Exchange sidebar widget or a Shortcode block, for example [clerqs_exchange id="sports" placement="sidebar-top"].
6. Use different placement IDs for different page locations. Open Overview to compare loaded items, visible items, raw clicks, and clicks per visible item.

If a sync reports HTTP 401, compare the invite keys privately. To replace one, use Edit on the partner row and supply the other installation's key. Then sync from both sites. New partners default to a 1,000-click debt cap. Existing partners keep their saved cap.

Saved widgets have an editable name, public title, layout, and category filters. Renaming retains the widget ID used by the shortcode. The editor previews eligible posts as you change the settings.

New installations and upgrades include Sidebar and Below article layouts. Both show thumbnails and headlines. Widgets omit the source domain, including layouts saved with the previous source label setting. Use the sidebar widget or add the displayed shortcode to a widget area. For Below article, add the shortcode after the Post Content block in the Single Posts template or place it at the end of an individual post. Default layouts are added once, so deleting one does not recreate it.

The post count applies to the whole widget. The widget shows one article per eligible partner in rank order, then repeats with their next matching articles until the slots are filled. A single partner can fill every slot. Article links open in a new tab or window.

A small “Trade traffic with us” link below the articles opens the Clerqs WordPress plugins page. Clicks on this link do not count toward partner trades.

== How the pilot counts ==

Eligible clicks are estimated unique browser clicks per sending site, receiving site, and UTC day. Repeat clicks from the same recognized browser contribute to the raw count. The plugin excludes recognizable bot user agents from eligible credit and skips explicit prefetch traffic. It sets a first-party browser cookie for one day when someone follows a tracked link. The database stores daily, per-partner hashes for deduplication and does not store visitors' IP addresses. Configure your site's disclosures and cookie controls before a public pilot.

The site hosting the widget gives higher placement to partners it owes. It stops adding new exposure for a partner once the partner reaches the configured debt cap. Old page caches can continue to show previously rendered items. The browser reports each loaded item and reports it as seen when at least half the item enters the viewport. These browser signals are estimates and can be affected by script blocking. Peers report their own totals, so trade with sites you trust.

Feeds are cached for 30 minutes, with a last-good cache for temporary failures. Article URLs must share the approved partner's HTTPS origin. The plugin adds WordPress featured images to its site's RSS2 feeds. Thumbnails can also come from other feed media metadata or images embedded in the item. An item without an image appears as a headline.

== Pilot scope ==

The plugin rate-limits tracking per connecting address and event type. The defaults are 300 tracked clicks and 600 visibility reports per minute. Clicks above the limit still redirect. The clerqs_exchange_tracking_limit filter accepts a custom limit per event type. Reverse proxies may share a connecting address across visitors unless the host restores the original client address. Use host-side request limits as well, especially if the site is public.

Background jobs archive events older than 30 days in batches. Daily partner totals and lifetime trade balances are retained. The widget reads cached feeds and does not make outbound requests while rendering. A newly connected partner can be warmed by selecting Sync now. Scheduled sync visits up to eight partners per run, checks its time budget between partners, and runs every five minutes via WordPress cron. Check cron and firewall behavior on staging before going live.

Pairing is manual and private. Countries, U.S. traffic bonuses, productivity bonuses, a public directory, and the Clerqs.com marketing page are outside this build. Pause or decline takes effect locally immediately and propagates to the peer on its next successful sync. Browser measurements and partner-reported click totals can still be manipulated and should not be used for billing.
