Website statistics can be used to help determine how to best develop the website. PHP-Nuke includes its own tracking module- you can find more information on this module in Using the PHP-Nuke Statistics
. However, if you want a much better and complete solution, you should incorporate Google Analytics into the PHP-Nuke website. This will require that you have an account with Google Analytics, and also do a little editing to the site code. The following article reviews how to add Google Analytics to your PHP-Nuke website.
Adding Google Analytics into your PHP-Nuke Website
Create Google Analytics Account and Get Tracking Code
You will first need to create a Google Analytics account, if you intend to use Google Analytics in your website. After your account has been created you will be able to obtain the tracking code. The code will be needed and should be on all pages that you intend to track. Since the HEADER.HTML for PHP-Nuke websites is typically on every page, you can place the Google Analytics code within that file.
- Go to Google Analytics and setup your account.
- Google provides the code that you will need for tracking your website data. Save this code for later use (or leave the window with the code open so that you can access it later).
The Tracking Code will look like the following:
var _gaq = _gaq || ;
var s = document.getElementsByTagName(‘script’); s.parentNode.insertBefore(ga, s);
Open the Web Site File(s) That require the Code
In order to access your files, we will be using the Cpanel File Manager
. You will need to know what theme you are using. If you know what theme you are using then skip the first two steps.
- Login to the PHP-Nuke Administration Back-end and click on PREFERENCES.
- Scroll to the bottom of the page and go to the Web Site Configuration section. Click on the THEMES option menu. It will then display the theme being used in the line labeled “Default Theme for your site.”
- Login to your Cpanel as an Administrator
- Go the File manager and navigate to the installation files for PHP-Nuke.
- Look for the THEMES folder. Double-click on the theme folder (inside THEMES) that matches the theme that you identified earlier.
- Click to highlight the HEADER.HTML file. Click on CODE EDITOR (or EDIT) at the top of the File Manager in order to edit the file.
Obtain the code that you received from Google and paste it into the editor immediately before the comment that says “close header”. This is demonstrated in the screenshot at right.
- Click on SAVE CHANGES in the top right hand corner to save your entries.
This completes the addition of the Google Analytics code to your PHP-Nuke website. Check the Google Analytics website for further options to add the tracking code (there are several options) in case your website theme cannot use the above method. If you require information on learning how to use Google Analytics, please to go Learn Google Analytics