How to monitor your site performance?
Written by Cynthia Fridsma
===================
Google Analytics is a great tool, but Google Analytics doesn't show you all the details you might need to keep your website interesting to your audience, and that's when you can use PHP to measure your site.
If you really want to know what's happening on your site, then you can use PHP and MySQL to track your site.
First, you need to create a MySQL database to store the referring URLs.
You can create the MySQL table with a tool like "PHPMYADMIN" but what's the fun in that? Instead we're going to create a installation Application that will create the MySQL tabel.
---// source code of installation.php //----
<?php
|
This script, if you use the right username, password and MySQL database, will create a simple table for the referring URLs in the database.
After you've executed the installation application, you will need a few lines of code that will store the referring URLs in the database.
----// source code of : search_engine.php //---
<?php |
What happens here?
This script will store referring URLs in the database. If there's no referring URL then the script won't store the URL.
if($search_string !=""){
$query= mysql_query("INSERT INTO {$site_id}_search_engine (url) VALUES
('". addslashes($search_string)."')");
}
With PHPMyAdmin, you can simply see what page is most viewed and how visitors came on your site.
You can throw various queries in PHPMyAdmin.
Tip
It's not so hard to add more information into the database, including the browser (are you using Internet Explorer, Flock, Google Chrome or FireFox?), the operating system (MS-Windows, Linux or that other operating systems that I won't name, it starts with an A and ends with PPLE).
Also, I would like to suggest that you create a separate connection script and use require_once('my_connection.php') to make the MySQL database connection. And you can include the search engine script on the pages that you want to measure.
--// connection script (connection.php) //----
<?php |
--// search engine script (search_engine.php) //---
<?php |
---// how to use the search engine script into your existing PHP webpage //----
<?php |
Use Facebook if you have questions related to this script.
P.S.
If you want to use this script with Horizon QCMS (The Heather Nova Online Magazine is powered by this amazing content management system) then
you won't need the connection script, add this in index.php:
$search_string = strtolower($_SERVER['HTTP_REFERER']);
|