Many WordPress site owners don’t know where to place Google Analytics code so they can track visits and their behavior on the site.
You can find many plugins which helps to implement Google Analytics code, but still sometimes that is not a good solution. Plugins can help but not always. Sometimes you have plugin conflict with some other plugin or it is incompatible with a WordPress theme you have choose.
Best way to add Analytics code into WordPress site is to add it by yourself. It is not so hard, and only takes a minute. However, first you must figure out where to place Google Analytics code.
My example shows you how to add code, and how to check if that code works.
First of all I made New Property and get my Google Analytics Code. Next thing I have done is that I logged into my sites as Administrator and navigate to Appearance and Editor. There are many *.php files and footer.php is the file I need. Open that file and find </body> line somewhere on the end. Place your new code right above that line and Save changes. This way my work about Google Analytics is done.
To check your code follow your Google Analytics dashboard in Real Time.
I check my code from Desktop PC and from Mobile device, and all looks OK. It may take some time for code to work, so be patient and wait for about 5 – 10 minutes. If you can’t wait and want to see if you done all right go to your page and – in Chrome – make a right click. Choose View Page Source and scroll all the way down. There you should see your Google Analytics code.
Important notice: Steps I wrote above only applies for Desktop and Responsive themes. In case you use some WordPress plugin to show Mobile and Tablet theme design then you need to find footer.php of those plugins also.
Thanks for reading my blog, and if you have any questions please don’t hesitate to write a comment.