I operate a small front end for a webshop where I receive 5% of the sale amount for every customer who makes a purchase after being referred from my website. However, I am struggling to track these customers and need help in setting up a system to monitor them accurately. In my webshop, I have created a page called collect.aspx which captures and stores the data passed through the query string using pseudo code like this:
string orderid = Request["orderid"];
string amount = Request["amount"];
..save to database
When redirecting customers to the webshop, I attempt to insert a javascript on the final purchase page. Despite several attempts, it seems that the only method that works is by tricking the browser into interpreting a JavaScript call, similar to this:
<script type="text/javascript" src="http://domain.com/mypage.aspx?orderid=4&amount=45/>
Observing how other trackers function, it appears to be a common approach. Nonetheless, I'm faced with the challenge of filtering out orders that are not related to my website. I have tried using a cookie when users visit my site and checking for its presence during the callback on the purchase page, but it seems impossible to retrieve the cookie when making the call. This issue is puzzling me greatly.
If anyone can share insights on best practices for tracking customers and resolving the cookie dilemma, I would greatly appreciate it. Any suggestions on implementing an effective tracking system are welcomed.