=== AffLoc — Affiliate Link Localization for Amazon & More === Contributors: affloc Tags: amazon affiliate, affiliate links, geo targeting, link localization, affiliate marketing Requires at least: 6.0 Tested up to: 6.9 Stable tag: 0.2.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Stop losing affiliate commissions from UK, Canada, and 190+ countries. Auto-redirect affiliate links by visitor country — no coding required. == Description == **Are your Amazon affiliate links not working for international visitors?** If you have traffic from the UK, Canada, Australia, Germany or other countries, you're likely losing a large chunk of your affiliate commissions every day. **AffLoc fixes this automatically.** It detects each visitor's country and instantly swaps your affiliate link to the correct regional store — Amazon UK, Amazon CA, Amazon DE, and 190+ countries. One shortcode. No coding. No per-click fees. = Why You're Losing Money Right Now = When a UK visitor clicks your Amazon US affiliate link, they get redirected to Amazon UK — but **without your affiliate tag**. You get zero commission. The same happens for Canada, Australia, Germany, France, and every other country. International traffic can account for 20–40% of a blog's total visitors. Without geo-targeting, all of that traffic earns you nothing. = How AffLoc Solves It = 1. Visitor arrives on your page 2. AffLoc detects their country (via IP, cached in browser) 3. The affiliate link instantly swaps to your regional URL 4. Visitor clicks — **you earn the commission** It's the simplest geo-targeting affiliate plugin for WordPress. = Key Features = * **Automatic Country Detection** — Detects visitor country accurately via HTTPS geolocation. Cached in the browser to minimize API calls. * **Unlimited Countries** — Set country-specific links for all 190+ countries. Assign Amazon US, UK, CA, AU, DE, FR, ES, IT, JP, and any other regional store. * **Global Fallback Link** — A default URL for countries without a specific mapping, so no visitor ever lands on a dead link. * **Cache-Friendly** — Uses a client-side JavaScript approach. Works perfectly with WP Rocket, W3 Total Cache, LiteSpeed Cache, and all major caching plugins. * **One Shortcode** — `[affloc_link slug="your-offer" text="Buy Now"]` is all you need. Works in posts, pages, widgets, and the block editor. * **Lightweight** — No bloat. Scripts only load on pages that use the shortcode. * **Import / Export** — Manage all your link mappings easily. Migrate between sites in seconds. = AffLoc vs Amazon OneLink = Amazon's free OneLink tool only works if you're enrolled in multiple Amazon Associates programs. Setting it up requires separate accounts for each country. AffLoc works with **any affiliate program** — not just Amazon — and requires zero extra registrations. = AffLoc vs Geniuslink = Geniuslink charges per click (starts at $9/month for 2,000 clicks). AffLoc is a flat $29/year — no per-click fees, no limits. For WordPress bloggers, AffLoc is the smarter choice. = AffLoc vs ThirstyAffiliates Geo Targeting = ThirstyAffiliates geo-targeting requires MaxMind database setup. AffLoc works out of the box — no database downloads, no configuration, no cron jobs. = Perfect For = * **Amazon Associates** who want to earn commissions from UK, Canada, Australia, Germany and beyond * **Travel bloggers** linking to regional booking and gear stores * **Finance bloggers** with international readers * **Niche site owners** targeting multiple countries * Anyone tired of losing affiliate revenue from international traffic = How to Set Up Amazon Affiliate Links for Multiple Countries = 1. Install AffLoc from the WordPress plugin directory 2. Go to **AffLoc** in your WP admin menu 3. Add a mapping: enter your offer slug (e.g. `laptop`), select country `US`, paste your Amazon US affiliate link 4. Add another mapping: same slug `laptop`, country `UK`, paste your Amazon UK affiliate link 5. Repeat for CA, AU, DE, or any other country 6. Add a fallback link for all other countries 7. Use `[affloc_link slug="laptop" text="Buy on Amazon"]` in your post That's it. Your readers automatically land on the right regional store. == Installation == 1. Upload the plugin files to the `/wp-content/plugins/affloc` directory, or install the plugin through the WordPress plugins screen directly. 2. Activate the plugin through the **Plugins** screen in WordPress. 3. Navigate to **AffLoc** in your WordPress admin menu. 4. Add your first mapping: enter a slug (e.g. `amazon`), select a country, and paste your affiliate URL. 5. Use the shortcode `[affloc_link slug="amazon" text="Buy Now"]` in your posts or pages. == External Services == This plugin relies on the following external services to function: 1. **ipapi.co** — Used to detect the visitor's country via HTTPS by resolving their IP address. Privacy policy: [https://ipapi.co/privacy/](https://ipapi.co/privacy/). No personal data other than the visitor's IP address is transmitted. 2. **flagcdn.com** — Used to deliver country flag icons in the WordPress Admin Dashboard. == Screenshots == 1. The **AffLoc admin page** — Add New Mapping form with Offer Slug, Country search, Affiliate Text and URL fields. Sidebar includes the Shortcode Helper and Import/Export tools. 2. The **Existing Mappings** table — all mappings grouped by slug, showing country flags, destination URLs, and ready-to-copy shortcodes. 3. Inserting the shortcode in the WordPress block editor (Gutenberg) — add a Shortcode block and paste `[affloc_link slug="your-slug" text="Buy Now"]`. 4. The front-end result — a geo-localized "Buy Now" button automatically swapped to the correct regional affiliate URL based on the visitor's country. == Frequently Asked Questions == = Are my Amazon affiliate links not working for international visitors? = Yes — this is the most common affiliate revenue leak. When a UK or Canadian visitor clicks your Amazon US link, they get redirected to their local Amazon store but **your affiliate tag is stripped**. AffLoc fixes this by automatically serving country-specific links so every visitor lands on the correct regional store with your tag intact. = How much money am I losing from international traffic? = It depends on your traffic split. If 30% of your visitors come from the UK, Canada, and Australia — and your average EPC (earnings per click) is $0.10 — you're losing roughly $0.03 per click from those visitors. For a site with 50,000 monthly clicks, that's $1,500/month in missed commissions. = Does AffLoc work with caching plugins? = Yes. The link substitution happens in the visitor's browser (client-side JavaScript), so your pages remain fully cacheable. AffLoc is compatible with WP Rocket, W3 Total Cache, LiteSpeed Cache, Cloudflare, and all major caching solutions. = Which countries are supported? = All 190+ countries with ISO country codes. You can set unique affiliate links for any country — Amazon US, UK, CA, AU, DE, FR, ES, IT, JP, IN, BR, and more. = Does it work with affiliate programs other than Amazon? = Yes. AffLoc works with any affiliate program — just paste any URL as the destination link for each country. Use it for Booking.com regional links, eBay affiliate links, Etsy, or any program with regional stores. = Is it compatible with the block editor (Gutenberg)? = Yes. Use the standard Shortcode block in Gutenberg and paste your `[affloc_link]` shortcode. = What happens if my visitor's country doesn't have a specific link? = AffLoc falls back to the default URL you set for that offer, so no visitor ever sees a broken or missing link. = How is this different from Amazon OneLink? = Amazon OneLink only works for Amazon affiliate programs and requires you to join the Amazon Associates program in each target country separately. AffLoc works with **any affiliate link**, requires no external account registrations, and runs entirely within your WordPress site. = How is AffLoc different from Geniuslink? = Geniuslink charges per click ($9+/month). AffLoc is a flat annual fee with no per-click charges — making it far more economical for WordPress bloggers with high traffic volumes. = How is AffLoc different from ThirstyAffiliates geo-targeting? = ThirstyAffiliates' geo-targeting feature requires downloading and configuring the MaxMind GeoIP database. AffLoc uses a lightweight API and works out of the box with zero configuration. == Upgrade Notice == = 0.2.0 = Major release introducing Free version usage limits, new "Affiliate Text" field, improved Admin UI responsiveness, and WordPress.org code compliance improvements. = 0.1.5 = Important security update adding strict IP validation and full HTTPS geolocation API support. == Changelog == = 0.2.0 = * Feature: Added maximum mapping limit for Free plan. * Feature: Added Affiliate Text field support in shortcode. * Refactoring: Conformed strictly to WordPress Database APIs for SQL queries. = 0.1.5 = * Enhancement: Added copy-to-clipboard functionality for shortcodes. * Enhancement: Admin UI improvements — country flags, grouping, search, date sorting, and row actions. * Security: Switched to secure HTTPS endpoints for IP geolocation. * Security: Added comprehensive IP validation including Cloudflare/proxy support. * Performance: Frontend scripts now load only on pages containing the shortcode. = 0.1.0 = * Initial Beta release.