Installing Google Analytics
Posted 04th October, 2018
Google Analytics is a free analytics tool which analyses and displays website traffic data. It consists of the following:
- User behaviour tracking, including pages opened, traffic sources.
- Information about each user's sessions
- Detailed informations on videos watched and other site usage data.
Before you start using the service, you will need to firstly make an account with Google Analytics. If you already have an account with google, you can use this to log in directly.
You will ned to validate your domain name: to do that follow these steps:
- Log into Google Analytics.
- Select Create new property option from the panel on your right.
- Add your domain name (select the preferred protocol and add it without any characters following the name, including a trailing slash (
yoursite.com
, notyoursite.com/
)). - Download the html validation file.
- Upload the validation file to the site directory on your hosting panel.
- Confirm uploading the file from the Google Analytics panel.
You will not be given a tracking code (in the format UA-) to add to your website.
Add Google Analytics to WordPress
Analytics can be added to the theme as follows:
- Connect to the file system on your hosting.
- Navigate to wp-content/themes/YourTheme/
- Using a text editor by choice edit your header.php file and right under the < body > paste the Google Analytics tracking code.
You may wish to create a child theme.
Alternatively you could install a Google Analytics Plugin to your website.