Install Analytics on Your WordPress Site Without Installing a Plugin

Before we start the process, first make sure you run backups for your WordPress theme, so if any problem happens, you can restore your theme back anytime.

You’ll need to be extra careful while editing the code that outputs your WordPress website. Any slight mistake made with the code would be capable of pulling down your site. Ensure you run a backup first before you begin installation.

Step 1: Obtain Your Analytics Global Site Tag (Tracking Code)


Start by logging into your Analytics account and choose the site on which you want to install the global site tag.

Move your mouse cursor to the left taskbar and click on Admin.

Choose the Tracking Info button through the property column, then the Tracking Code.

Under the Website Tracking section, you’ll find your Google Analytics tracking code. Just copy your code.

Step 2: Locate the Header.php File and Add the Analytics Tracking Code


Log into your WordPress back office and scroll down to Appearance, and then click on Editor. Click on the header.php file which is located below the Templates tab.

Right before the closing </head>, paste the copied Analytics tracking code, and then click on the Update File button. Make sure the file is edited successfully. If you don’t want to risk bringing down your website, then ask your hosting provider to assist you with pasting the tracking code.

That’s all!



Join the Discussion
Write something…
Recent messages
JulietAA Premium
Thank you Israel
Reply
timstime20 Premium
Thanks Israel
TIM
Reply
Israel17 Premium
Thanks for stopping by, Tim! Keep track of your site visitors using the MonsterInsights plugin. Thanks for reading!

Israel Olatunji
Reply
timstime20 Premium
Yes I’ve been using.
Reply
Israel17 Premium
Good to know, Tim! You rock, my friend!

Israel Olatunji
Reply
lesabre Premium
Hi Israel, thank you for the share.

Best wishes,
Michael
Reply
Israel17 Premium
Much appreciated, Michael! Thanks for stopping by! Glad you read my training on how to install Google Analytics with or without a plugin!

Israel Olatunji
Reply
hsgoad Premium
Very nice technical piece and I can see how it would be of benefit. I myself prefer the plugin approach. Have use Monster Insights fro a variety of Wordpress sites without any issue. Keep up the good work.
Reply
Israel17 Premium
Excellent, my friend! Good to know you have once used the MonsterInsights plugin and you had no issue with that no matter how little. That proves to others that it's a good plugin to use. Thanks so nicely!

Israel Olatunji
Reply
Fiona13 Premium
Thank you for sharing this training !
Reply
Israel17 Premium
You are much welcome onboard, Fiona! Glad you read this training! Much appreciated! Using the plugin approach is better and more effective for keeping track of your site visitors, and if you'd have any cause to switch your theme in the future, you can rest assured that there will be no problem at all. Thanks for stopping by!

Israel Olatunji
Reply
Fiona13 Premium
You are welcome Israel!
Reply
Top