Visits or referrals are not working

This article will help you perform some top line troubleshooting checks to determine why a visit is not being stored, or a referral is not being generated.

Troubleshooting Visits

The most common reason a referral is not generated is because a visit has not successfully been stored. Work through the below checklist to ensure visits are being stored correctly. You can view succesfully stored visits on the  Affiliates → Visits page in your WordPress admin.

  • Ensure AffiliateWP is installed and activated. Please ensure you are using the latest version of the plugin.
  • Ensure your affiliate's account is active on the Affiliates → Affiliates page .
  • Ensure you or your affiliates are using a correct affiliate referral URL, along with the correct referral variable, and an active affiliate ID (or username). Check out the acceptable URL formats in this doc: Affiliate URLs
  • Are you aware of any JavaScript errors on your site? You can see if you have JavaScript errors through the console of your internet browser. If there are any errors in the console when you are testing (keep it open so you can check), these will be outlined with a pink or red line and be very visible. Look out specifically for JavaScript errors - they will show a file pathname that ends with .js. These errors are the most likely culprits of plugin and theme conflicts, which can have an impact on visits not being stored, and therefore referrals not being generated.

Troubleshooting JavaScript errors

  • Temporarily deactivate all other plugins except for AffiliateWP, and test visits, and then referrals (with your chosen integration) to see if the JavaScript error disappears.
  • Slowly start reactivating other plugins. Do this one by one, or in small groups (of 2 or 3) and test the process each time. This will help you narrow down which plugin may be causing the conflict.
    • When you have determined which plugin is causing the conflict, we recommend contacting the plugin developer to see if they can help you resolve the issue.

Common JavaScript errors

  • "TypeError: $.cookie is not a function": This occurs because some hosting companies use an outdated mod_security ruleset which blocks the jQuery cookie script. The only way around this is to load new/renamed versions of the jQuery cookie script. Below is a fix for this error which you can download and upload to your WordPress admin as a plugin.

Fallback tracking method

If you're not able to fix JavaScript errors, AffiliateWP has a fallback tracking option which can be enabled to allow referrals to be generated. This fallback tracking method can also assist in cases where adblockers may be blocking the tracking script from loading. 

Enabling the fallback tracking method

You can enable this option in the  Affiliates → Settings → Misc tab, by checking the box next to Use Fallback Referral Tracking Method? and saving the changes.

However, whenever possible we do recommend fixing JavaScript errors, as they may also impact the performance of other WordPress plugins.

Troubleshooting Referrals

In the instance that visits are being stored correctly, but referrals are not being generated, use the below checklist to troubleshoot potential causes for this issue. You can view generated referrals on the Affiliates → Referrals page in your WordPress admin.

  • Ensure your chosen integration is installed and activated. If possible, please make sure you are using the latest version of your integration.
  • Ensure you have enabled your chosen integration/s in the Affiliates → Settings → Integrations tab.
  • Ensure you are not logged-in as the affiliate, or using the affiliate account's email address when testing a purchase, as by default AffiliateWP blocks affiliates from creating their own referrals (you can allow affiliates to generate their own referrals with the free Allow Own Referrals add-on).
  • Is the Ignore Zero Referrals option selected in the Affiliates → Settings → Misc tab, and you are trying to generate $0 referrals (e.g. for lead generation)? If so, referrals will not be recorded.
  • Is the Allowed Products free add-on installed and activated, and no products have been specified in the Allowed Products field on the Affiliates → Settings → Integrations tab? If you are using the Allowed Products add-on with your chosen integration, but have not specified any products, $0.00 referrals will be generated. If combined with the Ignore Zero Referrals option, no referrals will be generated.
  • If you have a caching plugin installed, please try clearing your cache and testing again. 

As of version 1.7.15, AffiliateWP now includes a handy debug tool to help diagnose common errors in the referral generation process. To enable this, go to  Affiliates → Settings → Misc, and enable the Enable Debug Mode tool. Then, in the Affiliates → Tools screen you'll see a Debug Assistant tab. Try testing the system again, and if there is an error with the system it will show in this log.

For more advanced users, defining AFFILIATE_WP_DEBUG as true in your wp-config.php file (as of version 1.8.3) will also globally enable debug mode.

If you need some help testing the system, take a look at our doc on  how to test everything is working

External issues

If everything else appears to be working, there may be a plugin or piece of code in your theme that is conflicting with AffiliateWP. This will require some more testing. If you have a staging or development server, we recommend ensuring it is up-to-date with your live site and performing the below additional tests in that environment. If you don't have a development server you can of course perform these tests on your live site. 

  • Temporarily deactivate all other plugins except for AffiliateWP, and test that visits are being stored correctly 
    • Then, whilst all other plugins are deactivated except for AffiliateWP, reactivate your integration, and test that referrals are being generated correctly. If referrals work correctly at this point, it is likely there is a conflict with another plugin you have installed or activated.
    • Slowly start reactivating other plugins. Do this one by one, or in small groups (of 2 or 3) and test the process each time. This will help you narrow down which (if any) plugin may be causing the issue.
    • When you have determined which plugin is causing the conflict, we recommend contacting the plugin developer to see if they can help you resolve the issue.
  • If referrals still aren't working, temporarily change your website's theme to a default WordPress theme (Twenty Fifteen, Twenty Sixteen, etc) and test the system again. If referrals start working after temporarily switching themes, it's likely some code within your chosen theme is causing a conflict with AffiliateWP. In this instance we recommend contacting the theme developer to see if they can help you resolve the issue.