title: How to count banner impressions and Clicks
body: <p>We have a small php script, that displays random adverts on our site . The banners are served from any location we designate.</p>
  <p>What I really would like to know, or be pointed in the right direction is, can we somehow collate the number of impressions each banner gets and possibly the click count on that banner.</p>
  <p>I am sure this can be done in php, and stored in a db. Just havent got a clue. I searched on Google, and seemingly everything I could find harks back to 2002 and 2003 lol.</p>
  <p>Here is our script:</p>
  <pre><code>&lt;?php
  $Img1 = &quot;path to image folder/banner.png&quot;;
  $Alt1 = &quot;alt text for banner&quot;;
  $Url1 = &quot;http://www.externaldomain.com&quot;;
  
  $Img2 =&quot;path to image folder/banner.png&quot;;
  $Alt2 = &quot;alt text for banner&quot;;
  $Url2 = &quot;http://www.externaldomain.com&quot;;
  
  $Img3 =&quot;path to image folder/banner.png&quot;;
  $Alt3 = &quot;alt text for banner&quot;;
  $Url3 = &quot;http://www.externaldomain.com&quot;;
  
  $Img4 =&quot;path to image folder/banner.png&quot;;
  $Alt4 = &quot;alt text for banner&quot;;
  $Url4 = &quot;http://www.externaldomain.com&quot;;
  
  $Img5 =&quot;path to image folder/banner.png&quot;;
  $Alt5 = &quot;alt text for banner&quot;;
  $Url5 = &quot;http://www.externaldomain.com&quot;;
  
  $num = rand (1,5);
  
  $Image = ${'Img'.$num};
  $Alt = ${'Alt' .$num};
  $URL = ${'Url'.$num};
  
  Print &quot;&lt;a href=\&quot;&quot;.$URL.&quot;\&quot;&gt;&lt;img src=\&quot;&quot;.$Image.&quot;\&quot; alt=\&quot;&quot;.$Alt.&quot;\&quot; /&lt;/a&gt;&quot;; ?&gt;
  </code></pre>
  <p>To initiate the above code ( we fire an include request )</p>
  <pre><code>&lt;?php include (&quot;../adserver/thescriptabove.php&quot;); ?&gt;
  </code></pre>