Skip to main content
WordPress gives you multiple installation options, but the safest AgentRef setup is still the same: load the script site-wide and keep checkout on a supported Stripe path.

Before you start

  • Set the program website in AgentRef to the same root domain your WordPress site uses.
  • Copy the exact script snippet from Settings -> Integration.
  • If WordPress is only your marketing site and checkout happens on app.example.com, install AgentRef on both surfaces.
If your site already uses a site-wide header-code plugin or theme option, paste the AgentRef script into the global head field.
<script
  defer
  src="https://www.agentref.co/api/tracking/script.js?pid=YOUR_PROGRAM_ID"
></script>
If you use caching, minification, or CDN plugins, clear those caches after installing the script.

Checkout compatibility on WordPress

Checkout patternRecommendation
Stripe Payment Links, Buy Buttons, or Pricing Tables embedded on WordPress pagesSupported directly.
Custom Stripe Checkout Session created by your own WordPress plugin or backend codeSupported, but you must follow the Stripe guide.
WooCommerce or another native WordPress ecommerce checkoutNot an automatic AgentRef checkout surface today unless you explicitly bridge attribution into Stripe metadata or report conversions server-side.
This is the key WordPress caveat: installing the script on a WooCommerce storefront captures referral visits, but it does not by itself guarantee automatic order attribution through WooCommerce’s native checkout path.
  • Shared subdomains under one root can share AgentRef cookies if the script is installed where the journey begins.
  • Different root domains cannot share first-party cookies automatically.
  • If you use a consent manager, call window.AgentRef.setConsent('granted') after the visitor opts in.

Verify the installation

1

Open a live affiliate link

Land on your published WordPress site with a real referral link.
2

Confirm cookies

Check for agentref_cid and agentref_pid in browser cookies.
3

Run a published-site test

Add ?agentref_debug=1 or ?agentref_verify=1 to a live page and inspect the result.
4

Validate the checkout path

If you use anything beyond hosted Stripe surfaces, confirm your checkout integration matches the Stripe guide.

Troubleshooting

  • The script is visible in WordPress admin but not on the live site: a cache or optimization layer is still serving the old template.
  • Clicks arrive but sales do not: this usually means WooCommerce or another plugin owns checkout and does not pass AgentRef metadata into Stripe.
  • Cookies exist on the marketing site but not in the app: install AgentRef on both subdomains.

Stripe Checkout

Required for custom WordPress-to-Stripe checkout bridges.

Server-Side Tracking

Use this when your commerce stack cannot pass through AgentRef automatically.

Consent and GDPR

Coordinate AgentRef with your cookie banner.