You usually need two data sets. The transaction ID and product are both the first and visitorID, and the products are considered as the second to get% of the confidence that all two products are sold (or viewed) together. You can use R (statistical software) and install a package called "arules" to easily create these recommendations.
Here is an example of code you can check in R
setwd ("C: / Documents and Settings / rp / Desktop / output"); install.packages ("arules"); library ("arules"); txn = read.transactions (file = "Transactions_sample.csv", rm.duplicates = FALSE, format = "single", sep = ",", cols = c (1,2)); basket_rules <- apriori (txn, parameter = list (sup = 0.5, conf = 0.9, target = "rules")); check (basket_rules);
If you really want to understand how this works, you can check out the white document http://www.tatvic.com/resources , named as product analysis drawing analysis, which shows how you can do this simply using your web data.
In addition, if you want to use a ready-made API for it, it is available at http://www.liftsuggest.com/how-lift-product-recommendation-works
source share