现在的位置: 首页 > 综合 > 正文

百度统计中js获取SEO数据的代码

2012年08月03日 ⁄ 综合 ⁄ 共 956字 ⁄ 字号 评论关闭
var a = document;
//var e = a.referrer;
var e = 'http://www.google.com.hk/search?hl=zh-CN&newwindow=1&safe=strict&q=w3ctech&aq=f&aqi=&aql=&oq=';

function f() {
	this.tags = {};
	this.clicks = [];
	this.getSt()
}
f.prototype = {
	sindex: [1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
	sengin: ["baidu.com", "baidu.com", "google.com", "google.cn", "sogou.com", "zhongsou.com", "search.yahoo.com", "one.cn.yahoo.com", "soso.com", "114search.118114.cn", "search.live.com", "youdao.com", "gougou.com", "bing.com"],
	sword: ["word", "wd", "q", "q", "query", "w", "p", "p", "w", "kw", "q", "q", "search", "q"],

	getValue: function(m, n) {
		var l = new RegExp("(^|&|\\?)" + m + "=([^&]*)(&|\x24|#)");
		var k = n.match(l);
		return k ? k[2] : ""
	},

	getSt: function() {
		var x = null;
		var k = e;
		var w = this.sengin;
		var u = this.sword;
		var q = this.sindex;
		for (var o = 0; o < w.length; o++) {
			if ((k.indexOf(w[o]) > -1) && (this.getValue(u[o], k))) {
				this.tags.sw = this.getValue(u[o], k);
				this.tags.se = q[o];
				this.tags.st = "2";
				return;
			}
		}
		return  this.tags;
	}
}
var b = new f();
alert(b.tags);
for (var k in b.tags) {
	alert(b.tags[k]);
	
}

抱歉!评论已关闭.