Recently I was thinking how to reduce the number of plugins in one of my WordPress installations, so I have to reconsider what things needed to have a plugin and what didn’t have to.
Here I was looking at the list of the plugins installed and notice that such a simple thing as google analytics could be one of those things. So I’m writing this post also for me, it’s great to have a reference place later.
Now to be completely precise the title of this post is not correct. It should be “How to add google analytics tracking code without a plugin.
The thing about the plugins is often add unnecessary things like extra stylesheets and scripts. While some allow you to disable stylesheets this in my experience is rather rare. So if you are looking to add only the tracking code and you are willing to get your hands a bit dirty with some code then keep reading.
So here we go:
- Get your Google Analytics tracking code
- Adding the tracking code to my website
1. Get your Google Analytics tracking code
To get the Google Analytics tracking code we need to have a Google Analytics account. If you don’t have one go ahead to https://www.google.com/analytics/ and create a new account. The process should be fairly easy, like creating a new email account.
Once you’re done with creating your account you must add into the account your website.
Give it a name, which can be whatever you want is only going to be shown in your Google Analytics dashboard. As well you will need to add your website’s URL, Choose what industry your website belongs to and finally the time zone.
2. Adding the tracking code to my website
Now that you have created your account and added your website to your account, you can get your Google Analytics tracking code and copy it to your Genesis website.
Where to find my Google Analytics tracking code?
Once you are in the Google Analytics dashboard go to the “Admin” panel, in the “Admin” panel you will see 3 columns: Account, Property and View
Make sure you are in the correct account and in the correct property. It should be you freshly added account and website.
In the property column you can find the “Tracking Code” link
Paste the code to your website
Now is the easy part, just copy the code to your clipboard and go to your WordPress site dashboard. Then go to Genesis -> Theme Settings -> Header and Footer Scripts and add the tracking code to the Header Scripts.
Don’t forget to save the changes.