Overview
Google Analytics is web analytics software offered free of charge by Google. You can use it to track your website traffic and view detailed reports.
You can read more about Google Analytics at the following links:
Retrieving your tracking code
- Create an account with Google.
- Sign into your account.
- Visit the Google Analytics login page.
- Click the Sign up button.
- The New Account page opens:
- Fill in all required fields.
- At the bottom, select which data sharing settings you prefer, and then click Get Tracking ID.
- Read the 'Terms of Service' agreement. When finished, click the I Accept button.
After you click the I Accept button, Google Analytics begins to load and shows you the following information about your account:- This page displays your 'Tracking ID' which appears in the following format:
UA-XXXXXXXX-X
- It also displays your 'Tracking Script' which appears in the following format:
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXXX-X', 'auto'); ga('send', 'pageview'); </script>
How to add the tracking code to your site
There are a few ways to add the tracking code to your site. View the following article for details:
If you're trying to add Google Analytics to a Remixer site, view the following article:
Adding the tracking script to each page
- Using the tracking script shown above, copy all the code including the <script> tags.
- Log into your site via FTP or SSH.
- Edit the code of any page you wish to track. For example, open your index.html page and paste the code before the </head> tag.
If you're using a different programming language and do not have an index.html file, place the code into its own file. Then, add that code to your page header file.
- Verify your configuration by visiting the following link:
Adding the tracking tag using Google Tag Manager
Adding the tracking code to your WordPress site
WordPress plugins
Using a plugin is the easiest way to add Google Analytics to your WordPress site. Below are a few of the many options available:
- Insert Headers and Footers
- Google Analytics by Yoast
- Google Analytics Dashboard for WP
- Google Analyticator
Manually pasting the code
It's never recommended to alter your core WordPress files unless you have an advanced knowledge of WordPress and know how to edit, save, and backup your work.
If you are comfortable editing files directly, you can insert your Google Tracking Code into your theme's header.php or functions.php file.
Verifying your tracking code configuration
It's important to regularly check your stats to confirm Google Analytics is functioning. The following article walks you through how to do this within the Google dashboard: