Affiliate tracking plugin
Written by Nico on October 9, 2009 – 2:40 am -I’ve been looking for an affiliate tracking plugin for wordpress and couldn’t find a single one. There are numerous plugins available that let you track the performance and manage affiliate programs that you have signed up for, but I was looking for the exact opposite: letting your signed up users refer new members and get credited for it.
I decided to write my own plugin for it, which I have just submitted to the wordpress.org plugin repository. It still needs to be approved for publication on the site, but you can already download it here.
The plugin lets your signed up members send traffic to any page on your wordpress site, appending ?affid=username to the end of the url (replacing username with their own username on your site) If someone registers on your site, the referring member will get credit for the new member. The plugin also lets you specify a page you want people to be send to after logging in (instead of the wordpress admin panel)
Other Posts you might like:
Tags: Affiliate Plus plugin, plugin
Posted in Affiliate Plus plugin, plugins | 68 Comments »



October 18th, 2009 at 5:33 am
Thanks Nico. That’s a great idea. I’ve downloaded and will be using it on my blog.
October 20th, 2009 at 7:17 am
Thanks for this plugin
A little idea for you : Add on the member profile how many referer_by are done with his link
October 21st, 2009 at 8:38 pm
Hi,
This sounds absolutely perfect Nico. Just what ive been searching for! I just hope it does what it says on the tin. If this works as expected I will definetely donate to you for this one.
Im almost overjoyed and alittle aprehensive at the same time. Feel like im one of the first ones testing it oout, but looking at stats its been downloaded 282 times from wordpress and who knows how many from here or elsewhere. And of course it is only a couple of weeks old!
Does this plugin play with the core files/theme in anyway? Anything to be worried about?
Should I download 1.0 or the dev version? What changes have been made to the dev?
October 21st, 2009 at 9:11 pm
ok forget that for a minute, after first test this seems to work a charm.
I will now take down my extended form referred by, or at least remove the field from the users profile page.
Is there anyway u think I could add the referred by and referred to the users profile, I can add extra fields easily enough so can just do it manually following the info this plugin gives me mind.
Also, where does this leave us in regards to SEO benefits of the affiliate links, ie having the ?affid=username at the end of the urls. Cookie tracking is of upmost importance, but the added benefit of gaining the link love is certianly a consideration for us. We want the traffic and users first, but we certainly want the link love aswell you know. What are your thoughts on this?
October 21st, 2009 at 11:40 pm
Maybe I can change the ? to # to avoid this duplicate content issues, not sure how though? some playing with the plugin files I imagine.
Also im not sure the rel=can is gonna work/help really, reading some bad stuff about it, so its gonna have to be a 301 on all affiliate links I think, do you have any recommendations about going about his?
Sorry for the multiple posts.
Phil
October 22nd, 2009 at 12:20 am
Phil, thanks for sharing your thoughts on the plugin, it enables me to improve it.
When writing the plugin, I didn’t spend much thought on SEO. The plugin was created for a specific purpose and it works like intended. Since SEO is a very important aspect for most webmasters some things will definitely be changed in future releases of the plugin in this field.
I have just read about a new parameter handling tool in Google Webmaster Tools. This seems to be the solution for your proposed problem. At least for the Goolge search engine (are there any others???)
A ‘referred by’ field on the userprofile page will be added in the next release.
October 22nd, 2009 at 10:43 am
Hi thanks for the reply, I will keep a close on on the updates of this and upgrade accordingly.
Couple more questions:
Is it possible for me to change the parameter affid to something alittle friendlier like shareid, camid, or whatever you know.
How are the cookies being set, ie if I set up a 301 on all affid urls are the cookies gonna stick in place? I know this prob depends upon the 301 set up, ie I need to tell it redirect but keep session data, but just interested in whether how the cookie/plugin data is built wil have an effect on me running this route.
October 22nd, 2009 at 10:47 am
Veyy noob school but maybe if I just change the following instances of affid (these are the only I can see)
if(isset($_GET['affid'])) {
$affid = $_GET['affid'];
global $wpdb;
// set cookie
setcookie(‘affiplus’, $affid, $exp, ‘/’, $affp_domain[0]);
}
}
to whatever I want it to be? Is that about the size of it?
October 22nd, 2009 at 11:31 am
Phil, I’ve added a few fields to the profile page earlier today. Version 1.1 is available to download.
I will look into incorporating the 301 redirect into the plugin.
If you want to use something different from affid, you found the right place to change. A word of advise though: it’s best not to change plugin files directly as the next time you upgrade the plugin your changes will be overridden and will have to be applied again. I will make the affid parameter changeable on the settings page in the next release.
October 22nd, 2009 at 12:03 pm
Nico, thanks for that! I will grab the 1.1 now and give it go.
Yeah I understand re making changes to the plugin files/code, but probably will go ahead and do so anyway -) Also if this option is being incorporated in the next release I guess I’ll only have to change it this once anyway eh! -)
The 301 would be a good touch indeed. I use allinoneseo and this has it set up for can issues etc already, guess this would have to play nice with that eh (if infact they have anything to do with one another).
As before, ill keep an eye on this page and the plugin itself.
Thanks again, your a legend.
October 22nd, 2009 at 1:31 pm
Hi, I dont know how soon (if not already im gonna piss you off). And whether or not you want me to take this to the wordpress location of the plugin. So please advise accordingly.
In the new version (1.1)
The profile fields appear, but they do not display any data, ie they show a “-” regardless of whether or not data should be pulled into them. I have tested this for both the “referred by” field and the “number of members referred” field.
Are these working for you?
Also still in regards to the profile fields, these dont get called up in my plugin, cimy-user-extra-fields, So I have no way of controlling them. It would be ideal if we could control not only the section title (currently Affiiate plus, but the titles for each of the fields aswell, along with the messages etc
On the same note the referral URL is shown ok, i.e http://www.site.com/?affid= but of course it is not adding the users name onto the end of that URL, if we had control of the text below it however this could be mentioned here, ie id say something like, add your user name to the end of the URL etc etc.
Cheers for all your hard work sir. Sorry again to be a bother.
Phil
October 22nd, 2009 at 1:40 pm
Also as a side note, I know all of the text and titles can be changed by editing the plugin files echos/outputs, so I can ammend it there.
So this is more a issue for making the plugin user friendly and easy for everyone in the future.
But the info/data called into those sections not working is obviously beyond my tinkering with the core files -)
Phil
October 22nd, 2009 at 3:02 pm
Man, I’ve got to install the block-phil plugin so you stop bothering me!
Seriously though, your feedback and thoughts are very much appreciated. I like my plugins to be of value to many wordpress users and without feedback they would only have the options that I think are useful to me. Hey, half the shit in the Ad Buttons plugin was added by user request and it is becomming a very nice plugin. Closing in on 20,000 downloads must mean something!
Well, back to the Affiliate Plus plugin: I see my ‘referred by’ and ‘members referred counter’ updated. All features are working fine for me before I release them into the wild, but that’s when stuff that I would have never thought of testing go wrong, so I’m very interested in why it doesn’t work for you…
When registering a new user, it should show the referring user name right under the e-mail field of the signup form. Does that show up for you?
Also, my profile page shows the http://www.site.com/?affid= link with the username in place like intended on two different wordpress installations that I use for testing
October 22nd, 2009 at 3:33 pm
Hey. Yeha that would be a nice plugin!
Ok, strangely now on the profile page, it has updated the users referred field, and now shows a number (1) instead of nothing as before. But however it shows this for both a user with no referrals and a user with referrals!
The referred by field is still blank, regardless of whether or not they were referred or not by blank i mean”-”.
In the backend, it is all working as expected though as per before.
On the registration page there is now the name of the refferal id under/next to the email field. This I would like to avoid having if possible. Unless I can have that auto fill into a field, I guess if I sort it with some css (ie if it is wrapped) then it will be fine.
But again the profile pages are not updating.
You can test this for yourself if you can be arsed.
http://www.pipthepip.com/?affid=kellpot
This may be something to do with my set up though of course.
October 22nd, 2009 at 4:00 pm
I thought I add quickly that, I am testing this all on one machine, so maybe that has something to do with it, maybe the cookies info is getting squewed somehow? although that said, it works at the back end, so that probably doesnt make any sense, cause if it works one place then its just a case of replicating that info somewhere else eh, maybe more to do with my in page pofiles/no backend for users.
October 22nd, 2009 at 4:05 pm
I’ve just signed up through your affiliate link and I can see the problem, it shows that I have referred one new member and I’ve not been referred by anyone. Very strange… Are you running the latest version of wordpress?
Have a look in your database the plugin should have created a affp_referrals table in your wordpress database with two columns: affp_id should list the user id number of the referred user (this is the ID found in the wordpress users table) and the second column lists the referral name (should be equal to a user_login from the wordpress users table)
I see the referral id shows up on the signup form, so everything works fine setting and retrieving the cookie
What do you see on the users list when logged in as admin? The list of names should have two new columns (referred by and referred) filled with a name and number respectively.
October 22nd, 2009 at 4:14 pm
Yes strange! Im using 2.84, so no not the very latest, but close.
The admin is displaying al information correctly.
I have the two new fields and the info in each is correct. For example nico was reffered by kellpot and nico2 was reffered by nico i think -) But either way the info is correct in the admin>users.
It is just when the data is being pulled to the profile pages we are having the problem.
I will check my db now and get back to you in quick order.
October 22nd, 2009 at 4:21 pm
Update, yes the DB has created all you listed. affp_referrals table with two columns: affp_id & affp_referral
listing numbers(ids) and usernames respectively.
The thing is, like I mentioned above, as the admin page is displaying the correct info, its not a case of the cookies/pplugin not working properly, its just that the data isnt ppulling into the profiles as expected right?
October 22nd, 2009 at 4:29 pm
I will say as just another little thought, having the affiliate id show up on the registration page is quite a good idea, but probably not the best. For this reasoning mainly, I want the option for offline users to be able to refer to use, they can only do so by a referral ID, so therefore the xtra form field I have, being referral ID is neccesary. And with that in mind having the name listed, unless again (I can float it into the actual field itself is not ideal).
That said, when offline users reffer, the client will not see the referral id by the email (or wherever I place it) – so its not a huge issue, but for people being reffered online, they will see the name and the field, kinda double whammy, especially when you think that I wil aim to float it below the field box it up and add a title, reffered by to it, if left.
If you catch my drift. -)
But either way, for now this profile issue is obviously more pertenent -)
Boy o boy Im a swine eh.
October 23rd, 2009 at 5:30 am
The possibility to manually enter a referral id would be a nice touch. How about this: if a cookie is found, the referral id is taken from it and placed into the box without the user being able to change it. If no referral link has been used to get to your site, the box is an input field where the visitor can manually enter a referral id.
One thing I have noticed in your profile page is the fact that the information isn’t displayed in the same order as on a standard wordpress profile page: the affiliate plus part is normally shown before the name part of the profile, your page shows it all the way at the bottom. How did your get the profile page to look like that? If it’s some other plugin, I’d like to test it on one of my test sites.
October 23rd, 2009 at 9:24 am
Hey that sounds like a good idea.
My profile page…I use ‘theme my profile’ plugin & ‘cimy-user-extra-fields’ plugin.
I think the former is what is outputting it like that. But cimy user certianly lets u add and remove fields easily enough.
October 30th, 2009 at 8:50 pm
Any more news on the movements of this plugin Nico? As it stands I need to find a way to remove the fields being outputted on the profile pages, as were giving out mis-information which could cause us problems. I will look to, for the mean time, just add the referral data manually for the info this plugin provides us. If you could help out with that, it would be much appreciated.
Cheers
October 31st, 2009 at 12:41 am
Hi again -) Im losing my mind here, trying to work out how to echo the number of referrals each user has, so im trying to display this info when they are logged in, not on the profile page, but on a custom page. Im an idiot when it comes to this stuff, and I figure you will obv know best, ive got to the point of realising its a global wpdb thing as apposed to just calling and echoing from the profile (cause nothing seems to work for me there) But whatever I try I cant get it to run.
October 31st, 2009 at 12:58 am
By the way, I know I want to know how to remove this info from the profile fields and show it elsewhere, but currently the profile fields for rerred b arnt working at all, but number of referrals is just counting the total count, so I guess the info is not getting called correctly per user which is effecting both.
October 31st, 2009 at 2:12 am
Please feel free to delete some of these comments Nico. After a good long stint trying to get this to work, I have finally got it outputting the correct numbers!!! WoopeeDoo eh. I guess I learnt a few things along the way, but probably not much -) I have gone ahead and reverted back to the 1.0 version as a simple solution to getting rid of the fields on the profile pages. And I will just use the info on a custom page as desired.
That said, I have no clue about the ramifications of this use, caching and pos security issues that may arise, but hey ho for now it is at least letting me show the number that the admin/user pages already had on show.
October 31st, 2009 at 3:12 am
That ‘theme my profile’ plugin you are using messes up the additional information on the profile page. I have been trying to get it to output the correct values, but it seems next to impossible.
Good to hear that you got the information on a separate page now, I’ll make the information on the profile page selectable in the plugin settings. A few other improvements are pretty much done, so look out for an upgrade!
Don’t worry about downgrading to 1.0, the profile page fields where the only addition to the 1.1 version
October 31st, 2009 at 11:40 am
Thanks Nico, sorry to hear youve wasted time trying to fix it for use inline with that partiular plugin, I may end up not using it and styling the profiles without the use of a plugin soon enough anyway.
I will say though, that it was outputting full values, ie total number of referrals, instead of per user, when I first got this to display on a seperate page using generally your plugin code ripped up. ie the count bit.
When I changed:
(“SELECT COUNT(*) FROM $table WHERE affp_referral = ‘$user_info->user_login’”)
to
“SELECT COUNT(*) FROM $table WHERE affp_referral = ‘$current_user->user_login’”
It started to output as per the logged in user as required, I assume this would work for the profile page itself aswell? Thing is you had it working on your test sites, so dont see why it would mine woould be diffent, even out of reach oof the profile page?
October 31st, 2009 at 11:42 am
Doesnt need saying but obv the missing brackets is a c and p error, the change was purely from $user_info->user_login to $current_user->user_login -)
November 3rd, 2009 at 2:00 pm
Hi, Nico
May I know where I can get login’s form for this plugin?
Thank you
November 3rd, 2009 at 2:39 pm
Dawan, this plugin extends the standard wordpress signup function. So, after activating the plugin users sign up as they would without the plugin. Do make sure that you have selected the ‘anyone can register’ option under settings->general in the wordpress admin panel or the ‘register’ link will not show up on the login form.
November 5th, 2009 at 9:15 am
Thank you for your replay, It’s working right know.
I tray to register with gmail is successfully but yahoo mail is never receipt username and password.
November 5th, 2009 at 12:35 pm
The registration mail that is send out is just standard wordress doing its thing. Looks like yahoo is blocking the mail, which could have different causes:
- they might block all wordpress registration mails
- mail from your domain or server is blocked. Check if your servers ip address or your domain is black-listed
see if you can specifically white-list your server or your wordpress from-address in your yahoo account.
November 9th, 2009 at 1:45 am
What a great plugin. It’s very promising.
Two questions:
1. How I can show a user’s referral count and referred by info to any registered user on a blog? The info would be shown on author.php.
2. Is it possible to create a best of – list of user’s with most referrals? A widget maybe, visible to every visitor on a blog.
November 9th, 2009 at 3:11 am
I will look into adding the referral count to the author page. A ‘top referrals’ widget is also on my list of things to add in a future release of the plugin.
November 11th, 2009 at 12:15 am
Great to hear! I hope you’ll find a way soon…
November 13th, 2009 at 5:00 am
Hi Nico,
Like your plugin
I want ask you that I have installed your plugin to my WP blog, and when I test him, its didn’t worked..
I was tried test by registration under my referral and its didn’t show any referrals under him, althogh I confirmed in email.
Can you please help?
Just amazing your plugins!
Thanks,
Liav
November 13th, 2009 at 5:03 am
I must says that all the information on the plugin or in my WP is OK.. But still have this problem.
I wish you can help me
Thanks!
November 13th, 2009 at 5:12 am
Liav, did you see the referral id field filled on the signup form?
November 13th, 2009 at 9:53 am
Hi Nico,
Thanks for contacting back !
I have tested this again according what you said me, but still… same problem.
Is your Plugin custom to specific subscribe plugin?
Thanks again!
Liav
November 13th, 2009 at 10:12 am
OHH I just checked again and I understand whats was the problem..
Thank you!
November 13th, 2009 at 10:56 am
Excellent, I’m glad you’ve worked it out. Care to share what was going wrong? Other people might run into the same problem, so it would be nice to have your solution listed here.
November 13th, 2009 at 11:02 am
Thanks Nico!
The problem was that I was found the referral field on the regual WP registration, instead on my subscribe users plugin. Then its work!
Your’e Great man
November 17th, 2009 at 8:12 am
Hi Nico,
Thanks for your plugin, its great!
I hope you can add some feature in future release, like:
- a widget to show referrer photo, maybe you can combine with “user photo” plugin
- added some referrer profile data like email in user profile
- email notification to referrer that someone has sign up on his referral
I wish I could contribute some script idea but I don’t understand a bit about programming
Thanks before Nico!
November 17th, 2009 at 9:38 am
Thanks for the ideas, they have been added to my list of things to add to the plugin.
November 20th, 2009 at 5:07 am
Have you seen this?
Mingle Wordpress Plugin
Integrate these and you got a winner!
November 20th, 2009 at 5:37 am
Hi!
I have trouble using the plugin. I changed the tracking code to tips and created a new user after going to umea.ungdomsportal.se/?tips=admin
At the registration-page, I could see admin as referral but when I later checked as admin, I didnt have any referred. I used two different computers and cleared cookies before registration.
Any idea what went wrong?
André
November 20th, 2009 at 10:00 am
I tried your url, but I don’t see any cookie. Did you disable the plugin again?
November 20th, 2009 at 12:41 pm
Hi!
Yes, I removed the plugin. I tested it with two more computers and it didnt work.
I have activated it again if you would like to take a look. This time, I use the default ID, affid.
Thanks
André
November 22nd, 2009 at 1:35 am
Hello
I’ve tried the plugin on a WP 2.8.6 version, it doesn’t work …
When I use a referral link to register, the cookie is present & the affid is in the field, but nothing show up in the user list row.
I use the default settings for the plugins etc.. No idea why it don’t work :/
November 22nd, 2009 at 4:47 am
I’ve one quick asking for you.
How I refer someone to register into my affiliate?
November 24th, 2009 at 8:29 am
Bobby, you should send people to the ‘referral URL’ found on your profile page
November 24th, 2009 at 8:50 am
Anon, what is the URL of your blog? I’d like to take a look and maybe find out what is going on.
November 30th, 2009 at 11:24 am
I have the same problem, it doesnt work. If I signup from link http//blabla/?affid=user , the user appear on Reffer ID box, but nothing changes on the reffered id user or on admin board on users. It is only – - …
November 30th, 2009 at 11:27 am
But if I write manually on the Reffer ID box an username works. If its by link it doesnt, why?
November 30th, 2009 at 11:59 am
Paul, I think I’ve found the problem. Expect an update to the plugin within the hour.
November 30th, 2009 at 12:03 pm
Alright, please if you have time fix it now :-p, I really need this plugin
also expect a donation if will work today hehe
November 30th, 2009 at 12:23 pm
Looks like it’s working now, please update to version 1.2.1. It could take a few minutes before the update shows on wordpress.org.
I just gave Paypal a call, they have someone standing by to receive your donation
November 30th, 2009 at 12:51 pm
One more question, this is related about wordpress, have any idee what I have to modify in wp-login.php that Remember me box to be checked by default?
Thanks
November 30th, 2009 at 1:15 pm
find:
and add the attribute “checked” (without quotes) right after tabidex=”90″ like this:
December 1st, 2009 at 5:56 pm
Seems that paypal “saw” something wrong in my account, so I got limited. I’ve sent now the documents, hope that they will fix it and I will do my promis soon, I don’t forget :-p
December 2nd, 2009 at 1:14 am
No worries! Did the little login-hack work for you? Not a very elegant solution, as it will be overridden on your next wordpress upgrade, so you’ll have to re-apply the change.
December 7th, 2009 at 10:16 am
wallah, I just get lucky, install this plugin in wp 2.8.6. after made some changes it work fine.. great plugins, thanks..
December 11th, 2009 at 1:28 pm
Wow I just came across this plugin and can’t wait to try it out. I like the Ad plugin on your other page as well. Thanks for the great work!
newbiesblogger
December 18th, 2009 at 6:54 am
Is there a way to set the desired page you want to visitors to hit, the first time they click on the referral URL (before they log in)?
That would be the link I would want in the users’ profile page. This would replace the “http://www.angelopc.com/?affid=123″ link, that shows by default.
December 18th, 2009 at 1:44 pm
Ed, the visitor can arrive at any page on your site. As long as the ?affid=123 is appended to the URL the affiliate tracking will work. I do understand what you want and this is currently not possible, I do think it would be a nice addition to the plugin. I don’t think it will be too hard to add. I’ll look into it, be on the lookout for an updated plugin in the next few days!
Here’s how I see your request:
-an additional field in the settings page where you can enter the landing page URL. (i.e. http://www.yoursite.com/introduction/)
-all visitors that arrive at your site with the ?affid parameter set will be redirected to the landing page
December 19th, 2009 at 9:48 am
Nico,
Bingo! That’s exactly what I need.
For now, I edited the plugin ($affurl) so that the users’ profile page actually shows the URL of the page I want all traffic to be directed to, with the ?affid parameter added to the end.
January 13th, 2010 at 6:41 am
Nico,
Are you aware that, even with the option unchecked, the Referral ID still shows up on the registration page (Register Plus). I’ve been meaning to tell you about that. If it’s going to be there, is there a way to show an explanation for it, to registering users?
“This will be part of your affiliate link.” or something like that.
January 14th, 2010 at 1:04 am
Ed the field will be hidden if the visitor has arrived through an affiliate link and the referral cookie has been set. If there has been no referral for the signup, the new user can manually fill in by whom he or she has been referred.