Affiliate Link to follow numerical sequence only

Hi I am using Post Affiliate Pro as a tracking system. I would like to get Affiliates and Post Affiliate Pro to designate the same Affiliate URL Link to each member as they sign up. I can set Post Affiliate Pro to change the affiliate link to suit all numbers and follow a certain pattern like starting from number 300 going to 301, 302, 303 and so on.

I need to get affiliates plugin to be able to produce a simple affiliate url as well. Is there a way to force the affiliate link sequences? Pref. Numbers as it is the only constant.

Kindly,

Paul

  • Paul

    Hi Bojan,

    Thank you for your reply. I meant I want to be able to change the affiliate reference link from ref=username-332 to a number only sequence. like ref=8349348. Is there a way to do this?

    This will allow me to coordinate this affiliate software with my other affiliate software and both can track the same reference link if I need to do this.

    I hope that is clearer.

    Kindly,

    Paul

  • Bojan Radonic

    Hey again @Paul,

    Thanks for the clarification. I don't think this is possible out of a box with the current version of the plugin.

    After some research on our site and checking old threads I've found an old one where this is explained, you can see it here:

    https://premium.wpmudev.org/forums/topic/changing-the-affiliate-referal-code

    In the same thread there is a simple solution that will change the referral link by adding the following to wp-config.php:

    define('AFFILIATE_REFERENCE_PREFIX', 'somethinghere');

    I've tested this on my end since this is an old thread and I've managed to change referral link with that. After adding it my new users referral link was somethinghere-45. I guess you can use numbers there too but I'm not sure this will get you exactly where you want to be.

    If this is not what you're looking for and you need to customize this then you can post a job in our job board where you can hire a developer to assist further:

    https://premium.wpmudev.org/wpmu-jobs/

    Hope this helps :slight_smile:

    Best regards,
    Bojan

  • Bojan Radonic

    Hey there @Paul,

    This is definitely possible but it will require making modifications to the plugin. According to our developer something like this would require more coding then simply removing that part from the affiliate link and developing custom code for custom functionality is beyond the scope of support that we provide. See here : https://premium.wpmudev.org/manuals/using-wpmu-dev/support-vs-custom-development/

    For such modifications I'll have to suggest hiring a developer that can assist you with that. You can use our Jobs board which I mentioned in my previous post.

    Best regards,
    Bojan

  • Paul

    Hi @Bojan Radonic Ok, since I don't have extra money - is there a way to know the algorithm used to produce the numbers at the end or is it simply random?

    I just need our major tracking system to be able to produce the same affiliate link as WPMUDEV Affiliates so it can be tracked automatically?

    Sad, everything was going so smoothly.. then boom - Brick wall.

    Just trying to get Post Affiliate Pro to produce the same exact affiliate link as Affiliates Plugin.

    If you anyone knows how the software chooses the number at the end of the affiliate link, that might be useful to ask PAP to set it up for me.

    -Paul

  • Bojan Radonic

    Hey again @Paul,

    I'll include an available SLS developer (our coding experts) so he can point out to the function that are creating the additional numbers.

    As much as we would like to help all our members with custom solutions we simply do not have time and manpower to do so, developing custom code for custom functionality is beyond the scope of support that we provide. See here : https://premium.wpmudev.org/manuals/using-wpmu-dev/support-vs-custom-development/.

    Best regards,
    Bojan

  • Jose

    Hi there @Paul,

    Hope you are doing great today.

    If you anyone knows how the software chooses the number at the end of the affiliate link, that might be useful to ask PAP to set it up for me.

    You need to look into the file ../wp-content/plugins/affiliate/affiliateincludes/includes/functions.php, line 184.
    This is the method that defines it:

    function aff_build_reference( $user ) {
    
    	if(defined('AFFILIATE_REFERENCE_PREFIX') && AFFILIATE_REFERENCE_PREFIX != '' ) {
    		$ref = AFFILIATE_REFERENCE_PREFIX . '-' . strrev(sprintf('%02d', $user->ID + (int) AFFILIATE_REFERENCE_KEY));
    	} else {
    		$ref = $user->user_login . '-' . strrev(sprintf('%02d', $user->ID + (int) AFFILIATE_REFERENCE_KEY));
    	}
    
    	return $ref;
    }

    In short, it is a combination of the user ID plus a fixes KEY value (it can be overridden) that is reverted using strrev().

    Now, if you need to integrate our Affiliate tracking with another system, you may want to use one of the provided hooks:
    - 'affiliate_click' : It will trigger whenever your site is accessed using a link containing an affiliate reference.
    -'affiliate_signup': Triggered when a new signup is completed from a link containing an affiliate reference.

    For the parameters sent within each hook, I suggest to search for the hook directly into the code to fully understand it. If there is something unclear, just ping me again here and I'll try to answer your questions.

    Hope this helps :slight_smile:

    Cheers,
    Jose