Learn how to add Google Analytics code without using plugin for WordPress

If you have site running on Word Press CMS and want to use Google Analytics service without using any plugin then try this method.

For many reasons plugin is not always the best solution specially if you need something like Google Analytics to track your site analytics.
Instead of using some plugin and hoping it will work correctly on your site maybe to consider adding Google Analytics code by yourself?
It is not so hard and it will take only few minutes if you know what you are doing.
It depends what Word Press theme you are using, but for most of them steps are the same.
First example ā€“ Using fully responsive theme (mobile friendly)
In this case you need to have your Google Analytics code prepared to copy/paste into your Word Press theme. Go to Dashboard and Appearance >> Editor
Look for footer.php file and open that file. Before you do any changes it is good to do copy of that file in case things go wrong.
After you have done copying your original file, it is time to change the one your site is using. Edit footer.php and find closing tag </body>. Right above that tag paste your Google Analytics code and save changes. Wait for a few seconds and see how it is working.
Second example ā€“ Desktop theme with mobile plugin (using plugin for mobile and tablet devices)
In this case, for Desktop version of your site all steps from above example are the same with few more extra steps.
To track your visitors (using mobile devices or tablets) you need to paste your Google Analytics code into footer.php of that plugin you are using. It depends of plugin, but you need to find its path and look for footer.php to paste code inside.
Now you have working Google Analytics to track your visitors without using any plugin. Word Press is famous CMS and you can find many plugins for that platform however that is not always best thing to do. With steps described above simply avoid using one more plugin for your site.

Add Comment