Double count view in archive.php

You fire setPostViews twice in ad.php

  1. via PHP setPostViews($adID);
  2. via JS with your ajax function again.

Remove one, and you should be fine.