How to add Google analytics script in WordPress site / Best place to add Google analytics code in WordPress?
This article is intend to beginners, who just confused about Google analytics code in wordpress site. Adding Google analytics script is very simple and easy. There are two ways of doing it, one is adding the analytics code manually in your header.php and other option would be installing the analytics wordpress plugin.
Some people suggest you to install the plug-in for wordpress, but i strongly recommend to avoid that, because it makes your site very slower and creates complication. The Best option would be adding the google analytics code in header.php manually, just because its trusted by millions of people around the world.Please follow me with step by step procedure…
1. Login into your word press site with admin access
2. Select the Appearance menu in sidebar, then choose Editor to see the list of php codes
3. After choosing Editor, you can find list of php codes on the right side bar. Choose header.php
4. Locate the header.php file and point the cursor above the </head> closing tag in the code
( you can find the </head > before opening the <body > tag
5. Paste your Google analytics code there and click the update File button in the bottom to complete the Google analytics code integration.
That’s it. Your Google analytics is ready for use and you can tack your visitor details. I see some of the bloggers are confusing and suggesting to put the google analytics code in footer.php. Please never try to do that, Always ensure that , you are placing the code before </head > tag in header.php