3

I'm creating a kind of affiliate marketing website with products I've scraped from partner websites. The user clicks on the Buy link and is re-directed to the partner site to complete the purchase. If the user buys the product, I should get a percentage of the sales. So far this model is a pretty common approach.

However the element that I don't yet understand is, what technology or script do other affiliate sites use to track to see if the user, once they've let the main site, does purchase the product or not? How do I track my user's purchase or actions once they've left my site?

I know that cookies can store brief user information but I don't think that's enough. I need to then store this information in a database. Should I use php sessions for this?

Any tips or suggestions is really appreciated. Cheers

user2028856
  • 3,063
  • 8
  • 44
  • 71
  • you will never know, only the site the go to and buy from will (and then not always) –  Sep 30 '13 at 20:59
  • But how do affiliate sites track when a user has bought a product and when to pay out commissions? – user2028856 Sep 30 '13 at 21:09

1 Answers1

1

What technology or script do other affiliate sites use to track to see if the user, once they've let the main site, does purchase the product or not?

Javascript. Affiliate Softwares usually have click tracking code which is placed on the landing pages. Once a vsitor comes to landing page through an affiliate website, a random visitor id along with affiliate id mapping is created which gets stored in the database. At this same time, a cookie gets created with the visitor id, affiliate id info etc. When the user finishes a purchase, there is a sales tracking code javascript code which is placed on the purchase page that gets trigerred. You can use create this code and insert the visitor's id along with affiliate id in the database.

How do I track my user's purchase or actions once they've left my site?

I have answered this partly in the above question. But once the user comes back again, it is going to recognise this user based on cookie and preferably you can store the session value in the cookie itself rather than the database, because the sale entry will get created in the database once the user has completed his purchase, if you have placed your sale tracking code at the end of purchase page.

aaron
  • 697
  • 4
  • 11
  • "When the user finishes a purchase, there is a sales tracking code javascript code which is placed on the purchase page that gets trigerred" Unless I misunderstood, this means I need to have access and modify the purchase page. However my situation is that the purchase pages are external 3rd party websites. I won't be able to insert any js into those pages. – user2028856 Sep 30 '13 at 21:17
  • "But once the user comes back again, it is going to recognise this user based on cookie and preferably you can store the session value in the cookie itself" But what if the user doesn't comeback after their purchase? Does this mean I won't be able to track their purchase status if they don't come back to my site – user2028856 Sep 30 '13 at 21:19
  • If your purchase pages are external 3rd party websites, then you will have to run a cron to compare the visitor against the purchase the person has made. I think you would only want to track users who have made a purchase on the website. yes, you will be able to track customers who have purchased a product but since you don't have an option of placing a javascript code on 3rd party website, you will have to use mechanism like running a cron as i said before. – aaron Sep 30 '13 at 21:36
  • I see. Okay suppose I can negotiate with my partner sites and place a sales tracking code on their sites, I still don't understand how will I track the purchase history of those users who don't come back to my site after a purchase? Do I need the sale tracking code to send a jsonp call with the users purchase confirmation to my database? – user2028856 Sep 30 '13 at 21:56
  • `I still don't understand how will I track the purchase history of those users who don't come back to my site after a purchase?`. why do you want to store a purchase history? Most affiliate systems give out commissions for one purchase per user. You wont give out commissions to affiliates for all the purchases that a user does. `Do I need the sale tracking code to send a jsonp call with the users purchase confirmation to my database?` you may use whichever method you are comfortable with as long as the entry gets created in the database for a purchase – aaron Sep 30 '13 at 22:03
  • "Most affiliate systems give out commissions for one purchase per user" wait, usually its only one purchase per user? I thought it was a % on each purchase made by a user – user2028856 Sep 30 '13 at 22:13
  • sorry, my bad. Yes, it is a % based or a fixed commission on each purchase made by a user – aaron Sep 30 '13 at 22:14
  • okay thanks for the tips and suggestions, they've really helped. cheers – user2028856 Sep 30 '13 at 22:22
  • @user2028856 have you completed this functionality? As I am working on the same thing but unable to understand how to track that `sale has been done with the same product`. Actually, I have created a script and put that on the partner site that is tracking the activity when user land to his website to purchase a product but I am not getting the logic that how can I confirm that same product has been sold or not? – Anshul Mishra Mar 15 '18 at 06:53
  • @aaron your logic is really helpful but does not help to think about the `sale tracking` code. I have put my script on `product description page` and `thank you page` once the user comes back to success page it tracks that sale has been completed but how can I track that the same product has been purchased. I have posted the question as well https://stackoverflow.com/questions/49008461/cross-domain-sale-tracking-system – Anshul Mishra Mar 15 '18 at 06:56