oshopindia Posted October 29, 2013 Share Posted October 29, 2013 Hello I want to start an affiliate programme for my online shopping website. If some customer comes to my site from a link from that affiliate site, how can I come to know and differentiate that customer from a customer who has directly come to my site? Should it be maintained in session? Or some php variable especially for tracking this? Thanks in advance Quote Link to comment Share on other sites More sharing options...
mentalist Posted October 29, 2013 Share Posted October 29, 2013 Check $_SERVER['HTTP_REFERER'] Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted October 29, 2013 Share Posted October 29, 2013 Check $_SERVER['HTTP_REFERER'] $_SERVER['HTTP_REFERER'] is not guaranteed to be set, or set with the right data. Says so right in the specs. Plus it's easily spoofable. Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted October 29, 2013 Share Posted October 29, 2013 @OP, you'll need to provide your affiliates a unique URL that you'll be able to verify their status with. I'm not entirely sure what the best method is - I've never had to deal with affiliates - but the idea is that your script will be on the lookout for a certain kind of request (likely something unique through GET to keep things easy for your affiliates) that it will be able to parse, then for the duration of that user's session they're tied to the affiliate. Quote Link to comment Share on other sites More sharing options...
mentalist Posted October 29, 2013 Share Posted October 29, 2013 Years ago when I first started advertising with Google etc, i'd have a "landing page" for each campaign, this then redirected onto the actual page. All this was logged so I could study them. Quote Link to comment Share on other sites More sharing options...
JonnoTheDev Posted October 29, 2013 Share Posted October 29, 2013 (edited) As Kevin has stated you need to identify which affiliate the inbound link has come from. Give each affiliate a unique key, some md5 string will be fine. Every link that the affiliate uses must contain their key. You could have a page that the affiliates can login to to see what links they can use. So, for instance, if an affiliate wants to promote a book that you are selling on your website from their own website they may use http://www.x.com/book/php-for-dummies?aff_id=adre34rfdrehkj87654 When a user lands on your site you must always be looking for that parameter (aff_id). If it exists, verify it, store it in a session, and if that user registers or buys on your site you know that the customer has come from a link that the affiliate has published. Affiliates will want to know what their sales are so you will need to create an affiliated members area for your website. You need to decide on commission thresholds, etc. You will also need to create a mechanism so you know how much and when to pay an affiliated member. If a customer buys something and then is issued a refund, the commission total for the affiliate may need to change. You need to decide all this in your business model. Edited October 29, 2013 by neil.johnson Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.