Notification
Tidak ada notifikasi baru.

How to block bot on your website?



Bot attacks can be annoying and can potentially risk your adsense account . it can even lead your account termination . so here in this blog i have shared a small code that you can use to stop bots attacking your website and potentially blocking them from creating invalid traffic on your website .

    
<script type="text/javascript">
  // Check if the visitor is a bot
  var isBot = /bot|googlebot|crawler|spider|robot|crawling/i.test(navigator.userAgent);

  // Check if the visitor's user agent contains "Macintosh"
  var isMacBot = /Macintosh/i.test(navigator.userAgent);

  // Redirect bots and Macintosh bots to a different page
  if (isBot || isMacBot) {
    window.location.href = "https://example.com/bot-blocked-page.html";
  }
</script>
    
  

Excited and hopeful, Insert the code snippet below the <head> section of my blog's template. To my delight, I noticed that the bot activity was no longer appearing on my Google Analytics dashboard!


Remember, if you are also facing similar issues with bot attacks, consider implementing the provided code snippet and see the positive results for yourself. Safeguard your blog and focus on creating valuable content without worrying about disruptive bots.

BLOGGING BOTS WEBSITE
Join the conversation
Post a Comment