Hi
I'm new on STM and i'm learning about mobile marketing.
Reading @caurmen tutorial about bot test i have tried to implement a bot detection cookie based.
My idea is based on principle that browser can saves cookies, but bot no (if it's doesn't been implements to work with cookies ...)
<script type="text/javascript">
// Set cookie.
function setCookie(name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
// Get cookie.
function getCookie(name) {
var cookie = " " + document.cookie;
var search = " " + name + "=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(";", offset)
if (end == -1) {
end = cookie.length;
}
setStr = unescape(cookie.substring(offset, end));
}
}
return(setStr);
}
// Delete cookie.
function delCookie(name) {
document.cookie = name + "=" + "; expires=Thu, 01 Jan 1970 00:00:01 GMT";
}
// Set cookie for 1 hour:
date = new Date();
date.setHours(date.getHours() + 1);
setCookie('i_m_a_bro', 'yes', date.toUTCString());
function redir() {
var cookieCheck = getCookie('i_m_a_bro');
if (cookieCheck == 'yes') {
delCookie('i_m_a_bro');
window.location.replace('REPLACE_URL');
}
else
alert ("YOU ARE A FUCKING BOT!");
}
</script>
</head>
<body onload="setTimeout(redir(), 300);">
</body>
Can you explain what this does man?
There is a thread about bot catching by means of cookies here : http://stackoverflow.com/questions/1...tilize-cookies
Simply said, bots can be coded to deal with cookies (ofcourse). Not all bots will be doing this (depending on their mission), so you might filter out those ones. However, In my experience, you'll get the best results by utilizing multiple filtering strategies Besides that, bots will be bots. In the end it's your marketing results that count.
I think it's good, but most trackers already set cookies, so I think you can do it simpler without having to set your own cookies in JS. You can check for the tracker cookies quite easily I assume. Also you can look for other traits of bots, i.e. window orientation etc, and only redirect the ones you want to send to the campaign. The non bots will "click through" in your tracker, while the rest won't and you can then filter down on placement, device, os etc.
I think this will take care of simple bots, most bots ...
Good approach! I like it.
If you really want to catch a lotta lotta bots, I'd recommend layering one or two other bot-spotting techniques on too. The simplest one is probably the hidden link: add a second link to your real lander (or you could even add a link to your redirect lander) that's hidden from human users, and mark as a bot anything that clicks through it.
How to hide the link? There are multiple ways: I like the "almost the same colour as the background" approach, but you can also absolutely position off-screen, use z-depth to put it behind something else, and so on.
It's also worth looking for inconsistent useragents, obvious datacenter referrers (yeah, I don't believe that Digital Ocean's staff are that interested in my eCommerce offer), and similar tells, but that starts to get into multi-layered detection which takes more time.