Cookieless.js是一个轻量级的使用Etag进行访客跟踪的Node.js扩展库。使用该库无需Cookie支持。
客户端代码:
$.ajax({ url: "https://127.0.0.1:7123/i.js", jsonp: "callback", dataType: "jsonp", success: function( visitor ) { //Do something trackImpressionFor(visitor.id, visitor.session); //example }});服务器端代码:
var CookielessTracker = require('cookieless'); /*Note: it's not mandatory to start a beacon, you may handle the requests yourself and just use the tracker's API*/CookielessTracker.startBeacon(7123, '0.0.0.0', function(visitor) { redis.incr('visits.'+visitor.id);});
评论