Keywords analytics that google doesn’t provide you for free.

Assume that you guys have a web server and using google analytics for doing some of the marketing data analysis, and you will notice that actually google analytics are not letting you to know what is the organic keyword that people reach to your site, you only will get something like below:

(not provided), oh gosh, it is such a pain for marketer to analysis data.

Keywords is actually not a key-point for doing Digital Marketing, but it is go to have for those marketer to analysis which keyword attracting the most visitor to your website as well.

In linux operating we can found out that you actually can install something call Awstats analytics tools, the important thing is it free.

Benefits of Awstats

  1. Complete Tracking and Full Log Analysis for Your Website
  2. Analysis Ip source to your site
  3. Number of Visitor
  4. Unique Visitor
  5. Referring Search Engine
  6. Search Keywords (Organic) This is what google doesn’t let you know
  7. Search Keyphrases (Organic) This is what google doesn’t let you know

In this tutorial we are going to install Awstats on Ubuntu to analysis the Website.

You will need to have a machines with Ubuntu Installed.


Step:1 Install Httpd on Ubuntu

sudo apt-get update
sudo apt-get install apache2 -y

Step2: Start apache2 service and enable it to autostart

sudo systemctl enable apache2
sudo systemctl start apache2

You are now able to view your webpage by http://ipaddress_of_server/

you will see something like below:

Congratulation, you are now successful install your Web Server on Ubuntu.

If you still have problem on opening this page, it could be your ufw blocking, please enter below command to allow access.

sudo ufw allow http
sudo ufw allow https

Step4: Install Awstats

sudo apt-get install awstats -y

Step5: Configuring Awstats

vim /etc/apache2/sites-available/000-default.conf

add the following line before the VirtualHosts closing tag.

Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon/ "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css"
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ScriptAlias /awstats/ /usr/lib/cgi-bin/
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

Save and exit the file

Step6: Editing hosts file or point the domain the the server ip address

You can be using your domain registrar to point the domain name to this server ip or otherwise you can edit the hosts file like below:

sudo vi /etc/hosts

adding below line with your server ip-address and your lovely domain name.
sudo cp -rv /etc/awstats/awstats.conf /etc/awstats/
sudo vi /etc/awstats/

Looking for wording below and add your Domain name as well.


HostAliases=” localhost″


LogFormat option set to 1 is because we have to get the organic keywords analytics working in Awstats later.

Save and exit the file

Step7: Restart Apache2 service.

sudo systemctl restart apache2

Step8: Update Awstats to Collect data from your httpd log file.

/usr/lib/cgi-bin/ -update

You will saw something like below:

Create/Update database for config “/etc/awstats/” by AWStats version 7.4 (build 20150714)
From data in log file “/var/log/apache2/access.log”…
Phase 1 : First bypass old records, searching new record…
Searching new records from beginning of log file…
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)…
Jumped lines in file: 0
Parsed lines in file: 3
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 3 new qualified records.

If your Logfile are not standard location as usual. You can be specific in /etc/awstats/


Now you are able to test your Awstats Log analyze by below link:


you will be same getting this page like us:

Congratulation, You are now more easy to analysis all your visitor data and the most important thing are keywords.

You can go over the left hand side link, Look for Search Key phrases, Search Keywords.

If you are not getting the same page like us, and you are getting something like below:

Please proceed to your Awstats.conf with below command

sudo vi /etc/apache2/sites-enabled/000-default.conf

Changes your config like below:

DocumentRoot /usr/share/awstats/
Alias /awstatsclasses “/usr/share/awstats/lib/”
Alias /awstats-icon/ “/usr/share/awstats/icon/”

Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AddHandler cgi-script .cgi .plAllowOverride All
Require all granted

Alias /awstatscss “/usr/share/doc/awstats/examples/css”
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ScriptAlias /awstats/ /usr/lib/cgi-bin/

Save and exit the file.

Run below command to enable cgi module and prevent when you access become plain text.

sudo a2enmod cgi

systemctl restart apache2

And try again access your Website Awstats again.


For the keywords analytics, of course you have to Wait until visitor hit your side by keywords and only you are able to see the data like below:

And now we have to set a cronjob for keep update your Awstats data from your access.log of httpd

sudo crontab -e

*/10 * * * /usr/lib/cgi-bin/ -update

Every Ten minutes your Awstats will automatic update data from your log file.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *