Tracking User Actions with Affiliates

One of the most common requests we get on our support forums is:

How to track user actions and compensate affiliates?

or other variations that basically ask the same thing:

How to integrate Affiliates with the xyz plugin?

With the free version of Affiliates plugin this is pretty easy using an API function provided exactly for that purpose.

affiliates_suggest_referral( $post_id, $description, $data, $amount, $currency_id, $status, $type, $reference );

The affiliates system will record a referral based on the arguments passed to this function. I won’t go into further details and explain the functionality behind this, since the source code is public in the plugin’s dedicated repository:

Alongside this, you have full access to the source code of the whole plugin.

The main point here is that you can easily integrate every other plugin with Affiliates, using a single function. A list of existing integrations can be found here:

The second part is what you are trying to integrate. All you need to do is find a hook that runs when this action is triggered. The user completes an action, a hook is called by the plugin in question for that action, and then the Affiliates plugin function runs.

Job done!

Even when the other part doesn’t provide a hook for that action, it’s always good to ask for it in their support channels. Perhaps you have discovered a use case that nobody else did.

The rest is just a matter of personal knowledge around PHP and the WP API. Luckily the community around WordPress is pretty advanced and you can easily find free tips, but also professional advice easily. 😉

Reference Implementations

The following implementations integrate with the free Affiliates plugin. Their code can help you to implement your own integration:

In addition to these, the following extensions also are interesting if you want to extend or build your own extension for the system:

Advanced APIs

The premium versions Affiliates Pro and Affiliates Enterprise provide extended APIs that make it easy to cover more complex integrations, including those based on the advanced rates system that these versions provide:

Photo credit: Photo by Anthony Wade on Unsplash

, , , , , , , , , , , , , , , , , , , ,

No comments yet.

Leave a Reply

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account