How to Build an Affiliate System in ColdFusion
ColdFusion is a programming language that allows programmers to speed up programming by converting complicated tasks into lines of code. This program is commonly used to create Internet applications using less coding, such as e-commerce features that allow users to browse for products, add products to a shopping cart and easily pay for them using a credit card. An affiliate program is one where website owners and professional affiliate marketers sell a company’s products and services and receive a commission for each sale. ColdFusion software can be used to allow users to place code on a website and send visitors to your website. The code lets you know which affiliate sent a customer to buy what product.
Instructions
-
-
1
Create a code that produces a URL for your website with a unique siteID. The siteID is a code that lets your website know when traffic comes from an affiliate. This link sends the user to a gateway page, which places a cookie on the user’s computer, letting the website know where the user came from. Once the user places an order, the Linkshare transaction is generated after the order placement.
-
2
Redirect the user to the part of the website that corresponds with the product that the affiliate was linking to. The code should redirect to the homepage if the product is not found.
-
-
3
Set the cookie to expire after a long period of time, so the affiliate gets credit if the visitor eventually purchases a product, even after leaving temporarily. Not rewarding affiliates for driving traffic will discourage affiliates from driving traffic in the future. Tell your website to check for a cookie using the “<!--- Check for cookie --->“ tag.
-
4
Use “<!--- get GMT time ---> to get the time that the visitor arrived.
-
5
Add the ”<!--- prepare transaction data XML string --->” to your code. Add <!--- Convert to Base64 and URL Encode the XML ---> and <!--- MD5 MAC encode the XML transaction
!!! SEE HMACMD5 code snippet !!!
---> to the code. -
6
Send relevant information to LinkShare with the <!--- send transaction to LinkShare --->
code. LinkShare is a service that records and maintains affiliate and business relationships. It allows businesses to easily pay affiliates for commissions. -
7
Log the transaction into your database using <!--- <cfset loglinkshare = createObject("component","/components.linkshareUtils").logOrder(orderid:session.order.orderid,customerid:session.order.customerid,siteid:cookie.linkshare_siteID,response:lsResponse,transXML:linkshareTransactionData,md5Hash:xmlmd5)>
---> in the code.
-
1
Tips & Warnings
Create a copy of your code in case you make changes that are damaging to the website. Simply rename the old code as the new code file name – if you make a mistake that you cannot fix – and replace the new file.
References
- Photo Credit Comstock/Comstock/Getty Images