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

  1. Install the Offertown plugin from the WordPress plugin directory (or upload the ZIP) and activate it.
  2. In WordPress admin, open WooCommerce → Offertown.
  3. Paste your program ID into the Connect Offertown Affiliate Program field and save.
  4. 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

EventWhenEffect in Offertown
Lead capturedA referred visitor leaves their email on your storeCreates a pending referral attributed to the referrer
Sale capturedA referred customer completes an orderMarks the referral converted with the order value
Coupon used / updated / deletedReferral coupons change in WooCommerceRecorded for auditing and reporting
Sale deletedAn order is removed in WooCommerceRecorded 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:

HTML — before </body>
<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_code query 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:

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).