How to use Google Analytics with PHP-Nuke
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.
NOTE: Before making the following changes, be sure that you make a complete backup of your website. If you require information and you used Softaculous to load your site, see the following article: Backing Up and Restoring Your Website using Softaculous. You can also make a backup using FTP - see How to Create a Backup Using FTP.
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 || ;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
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.
Did you find this article helpful?
We value your feedback!
Why was this article not helpful? (Check all that apply)The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
new! - Enter your name and email address above and we will post your feedback in the comments on this page!
PHP-Nuke Web stats and reporting
|1.||Using the PHP-Nuke Web Statistics Report|
|2.||How to use Google Analytics with PHP-Nuke|
Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!