This way you can get stats from your logs but this method is a little bit rudimentary as you are going to get visits from crawlers, bots,… that are not real visits. Parse your logs directly with awk.
#!/bin/sh
echo 'Number of unique visitors'
cat /var/log/apache/www.yoursite.com-access.log |awk '{print $1}' | sort | uniq | wc -l
echo 'Ip of unique visitors'
cat cat /var/log/apache/www.yoursite.com-access.log |awk '{print $1}' | sort | uniq | wc -l |awk '{print $1}' | sort | uniq