Javascript 和网上商店跨网站跟踪/联属,怎么做?
我有一个网上商店的小型前端。所有浏览我的网站并从网上商店购买商品的客户我都会获得 5% 的退款。我需要找到一种方法来跟踪我从我的网上商店转发到其他网上商店的客户。然后让网上商店在购买后回复我。在我的网上商店中,我制作了一个小页面:collect.aspx,它请求并保存在查询字符串中传递的值,类似于以下伪代码:
string orderid = Request["orderid"];
string amount = Request["amount"];
..save to database
在网上商店中,我将客户转发到我在购买的最后一页上插入一个javascript流动。我已经尝试了很多方法,但似乎唯一有效的方法是欺骗浏览器,让其认为我正在引用 JavaScript,如下所示:
<script type="text/javascript" src="http://domain.com/mypage.aspx?orderid=4&amount=45/>
我看到其他跟踪器是如何完成他们的工作的,这似乎是一般的做法它。然而,通过这个脚本,我得到了所有订单,我只想记录那些属于我的订单,那些通过我的网站输入的订单。
这是我的大问题,该怎么做?我在用户打开我的页面时添加了一个 cookie,并且我想在购买页面进行回调时再次检查此 cookie。当浏览器进行“”调用时,我似乎无法从浏览器获取 cookie。这现在真的很困扰我。
谁能告诉我这通常是如何完成的,这种跟踪。关于这个饼干,我缺少什么?
非常欢迎有关如何做到这一点的所有想法。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
cookie 方法不是很好,因为大多数浏览器都会阻止第 3 方 cookie。相反,我通过在他们访问我的页面时记录 IP 来解决这个问题,并在脚本调用返回时再次记录它。工作正常。
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.