Random affiliate

Hi,

Could you suggest solution (maybe hook) to assign affiliate based on my algorithm?

ex: if there is no referal link, I would like to select random affiliate /or based on my method/ and persist it.

How could I make it?

Denis

One Response to Random affiliate

  1. George August 18, 2016 at 6:04 pm #

    Hi Dennis,

    You should check the option to store Direct referrals, when there is no affiliate attributable.
    Then you should use the filter affiliates_service_affiliate_id if the affiliate_id=1( Direct affiliate’s id), apply your method and return that affiliate_id.


    add_filter( 'affiliates_service_affiliate_id', 'gt_affiliate_id', 10 , 2 );
    function gt_affiliate_id ( $affiliate_id, $service ) {
    if ( $affiliate_id == 1 ) {
    //...calculate the new affiliate_id
    //...set it as the affiliate_id
    $affiliate_id = 7; //for example affiliate with id 7
    }

    return $affiliate_id;
    }

    Kind regards,
    George

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

Share