title: Exclude bots and spiders from a View counter in PHP
body: <p>I have built a pretty basic advertisement manager for a website in PHP.</p>
  
  <p>I say basic because it's not complex like Google or Facebook ads or even most high end ad servers.  Doesn't handle payments or anything or even targeting users.</p>
  
  <p>It serves the purpose for my low traffic site though to simply show a random banner ad, count impression views and clicks.  </p>
  
  <p><strong>Features:</strong></p>
  
  <ul>
  <li>Ad slot/position on page</li>
  <li>Banner image</li>
  <li>Name</li>
  <li>View/impression counter</li>
  <li>Click counter</li>
  <li>Start and end date, or never ending</li>
  <li>Disable/enable ad</li>
  </ul>
  
  <p>I am wanting to gradually add more functionality to the system though.</p>
  
  <p>One thing I have noticed is the Impressions/views counter often seems inflated.</p>
  
  <p>I believe the cause of this is from Social networks' spiders and bots as well as search engine spiders.</p>
  
  <p>For example, if someone enters a URL from a page on my website into Facebook, Google+, Twitter, LinkedIn, Pinterest, and other networks, those sites will often spider my site to gather the webpages Title, images, and description.</p>
  
  <p>I would really like to be able to disable this from counting as Advertisement impressions/view counts when an actual human is not viewing the page.</p>
  
  <p>I realize this will be very hard to detect all these but if there is a way to get a majority of them, at least it will make my stats a little more accurate.</p>
  
  <p>So I am reaching out for any help or ideas on how to achieve my goal?  Please do not say to use another advertisement system, that is not in the cards, thank you</p>
  
  <p><img src="https://i.stack.imgur.com/tGplC.png" alt="enter image description here"></p>