$embox = function(site_id){
var source = '', content = '', d = document,
_get = (function(){
for(var q = {}, pairs = location.search.substr(1).split('&'), le = pairs.length, i = 0, par; i < le; i++){
par = pairs[i].split('=');q[par[0]]=par[1];
}return function (key) {if (q[key])return q[key];return ''};
})();
this.source = function(value){source=value;return this};
this.content = function(value){content=value;return this};
this.hit=function(){
var cookie_name = "sbx" + site_id,
match = d.cookie.match(new RegExp(cookie_name + "=([^;]+)")),
value;
if (match == null) {
if (d.referrer&&!_get("sembox_noref")&&!_get("sembox_source")){var inter = d.referrer.toString().indexOf(window.location.hostname);if (inter === 7||inter === 8)return false}
value = '&sembox_source='+(encodeURIComponent(_get("sembox_source")) || source)+
'&sembox_content='+encodeURIComponent(_get("sembox_content") || content)+
'&sembox_p='+encodeURIComponent(_get("sembox_p"))+
'&sembox_ka='+encodeURIComponent(_get("sembox_ka"))+
'&gclid='+encodeURIComponent(_get("gclid"))+
'&ref='+encodeURIComponent(d.referrer);
d.cookie = cookie_name + '=' + value + '; path=/';
} else if (match[1] === 'y') {
return;
} else {
value = match[1];
}
if (value) {
var img = new Image();
img.src = $embox.host + 'sembox.it/index.php?load=conversioni&act=hit&c=' + site_id + value;
img.onload = function() {
d.cookie = cookie_name + '=y; path=/';
};
}
};
};
$embox.host = (("https:" == document.location.protocol) ? "https://tracking." : "http://tools.");
(function(queue){
for (var i = 0, le = queue.length; i < le; i++)
queue[i]();
})(window.$embox_queue||[]);
