WooCommerce plugin
Connect a WordPress/WooCommerce store to your Offertown program with no code. The plugin captures sales and leads, tracks coupon usage, and registers your site so the widget can be embedded.
Requirements
- WordPress 5.3 or newer, PHP 7.4 or newer
- WooCommerce installed and active
- An approved Offertown partner account with a configured program — your program ID (
pub_…) is shown in the partner dashboard
Install and connect
- Install the Offertown plugin from the WordPress plugin directory (or upload the ZIP) and activate it.
- In WordPress admin, open WooCommerce → Offertown.
- Paste your program ID into the Connect Offertown Affiliate Program field and save.
- That’s it — on save, the plugin registers your site’s origin with Offertown (required for the embedded widget) and starts reporting events server-to-server.
What the plugin reports
| Event | When | Effect in Offertown |
|---|---|---|
| Lead captured | A referred visitor leaves their email on your store | Creates a pending referral attributed to the referrer |
| Sale captured | A referred customer completes an order | Marks the referral converted with the order value |
| Coupon used / updated / deleted | Referral coupons change in WooCommerce | Recorded for auditing and reporting |
| Sale deleted | An order is removed in WooCommerce | Recorded for auditing — it does not reverse a confirmed conversion; use your dashboard (or contact support) for corrections |
All calls are made from your server (PHP) to https://offertown.net/api and identified by your program ID — no API key is needed for the plugin.
Referral link tracking on your domain
When a friend clicks a referral link they land on your site. To keep the attribution on your domain (so a purchase days later is still credited), add the Offertown tracker script to your site’s pages:
<script
src="https://offertown.net/affiliate-tracker.js"
data-program-id="pub_YOUR_PROGRAM_ID"
async
></script>The script is tiny and conservative:
- It only acts when the page URL contains a
ref_codequery parameter from a referral link. - It writes one first-party cookie,
offertown_wp_ref(90-day lifetime), on your domain. Nothing is sent anywhere — no network calls, no personal data. - It never throws into your page; failures are silent.
Remember to list this cookie in your site’s cookie notice — see our cookie policy for suggested wording.
Advanced: custom API base URL
For staging environments you can point the plugin at a different Offertown deployment by defining OFFERTOWN_API_BASE_URL in wp-config.php:
define( 'OFFERTOWN_API_BASE_URL', 'https://staging.example.com/api' );Troubleshooting
- Events not arriving: verify the program ID is exactly the
pub_…value from your dashboard — invalid IDs are rejected (the API answers 404 by design, without revealing whether an ID exists). - Widget won’t load in an iframe: re-save the settings page so the plugin re-registers your site origin.
- Firewall: make sure your host allows outbound HTTPS requests from PHP (
wp_remote_request).