问题
I have a small front end to a webshop. All customers that go through my website and buy an item from the webshop I get back 5% of the amount. I need to find a way af tracking the customers i forward from my webshop to the other webshop. And then get the webshop to reply to me when the purchase has been made. In my webshop i have made a small page: collect.aspx that requests and saves the values passed in the querystring, something like this pseudo code:
string orderid = Request["orderid"];
string amount = Request["amount"];
..save to database
On the webshop i forward customers to i get to insert a javascript on the last page in the purchase flow. I have tried a lot of things but it seems that the only thing that works is to fool the browser into thinking im referring a javascript, like this:
<script type="text/javascript" src="http://domain.com/mypage.aspx?orderid=4&amount=45/>
I saw how other trackers did their bit, and this seems to be the general way of doing it. With this script however, i get all the orders, i only want to log those that belong tome, those who entered through my website.
Here is my big problem, how to do this? I added a cookie when the user opens my page, and i want to check for this cookie again when the purchase page make the callback. It weems that i cant get the cookie from the browser when it makes the "" call. This is really buggin me now.
Could anyone please tell me how this is generally done, this tracking. And what am i missing in regards to this cookie thing?
All ideas on how to do this is very welcome.
回答1:
The cookie approach is not very good, since most browsers block 3rd party cookies. Instead i solved it by logging IP when they visit my page, and the log it again when the script calls be back. Works fine.
来源:https://stackoverflow.com/questions/2660427/javascript-and-webshop-tracking-affiliate-across-websites-how-to-do