How do we add Google Analytics in WordPress
Step 1. Go to http://www.google.com/analytics/
- If you already have a Google Account and is already logged in, just click “Access Analytics”, then click “Edit” on the website you want to put the analytics, click “Check Status” and go to Step 3
- If you don’t have a google account, click “Create an account now” and go to Step 2
Step 2. Click Sign Up (If you are accessing Google Analytics for the first time)
- Enter your website URL, Account Name and Time Zone Country, click “Continue”
- Enter Last Name, First Name, Country, click “Continue”
- Read Google Analytics Terms of Service and check “Yes, I agree to the above terms and conditions.”, and click “Create New Account”
Step 3. Copy Google Analytics Code which looks like this
<script type="text/javascript">// <![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'xx-xxxxxxxx-x']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.
google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
// ]]></script>
Step 4. Adding in WordPress.
- You can add Google Analytics in Two ways: Using a Plugin or Manual Insertion
- WordPress Plugin: Download Google Analytics for WordPress Plugin
- Manual Insert: Login to WordPress Admin, click Appearance->Editor, click Header and insert the code before the closing tag
Note: Before, Google recommends that you put the code before the tag but they changed this recently, the problem with this is if a code in the body stops execution, the analytics code will still trigger because it is in the head (more on this soon!)

