Last week, we discussed how WordPress plugins are one of WordPress’ greatest strengths … and how they can also be one of its greatest weaknesses.
The key to effective use of plugins is to deploy them only from properly vetted sources, and only when necessary.
Plugins should solve a specific problem or provide an essential function. They should not indulge our vanity or our desire for a “shiny new object”.
In this post, let’s get specific and discuss a decision-making framework for a specific type of plugin that can be applied across many different plugins.
We’ll focus on a type of plugin that we see often, and whether it’s needed or not — plugins for Google Analytics.
Do You Need a Plugin to Run Google Analytics?
Before you ask yourself what plugin you should use to install and manage Google Analytics code on your website, ask yourself this more important question first:
Because if you do not need a plugin for Analytics, why install one?
Obviously, if you wanted to get literal, no one truly needs a Google Analytics plugin. Without much effort, you can copy the Analytics code and paste it into either your header.php or footer.php file (or just drop it into a simple box, if you use the Genesis Framework) so that it gets called on every page.
However, installing Google Analytics code in this way presents the following potential issues:
- If you’re not comfortable editing PHP, you could screw up your header or footer file and not know how to fix it.
- If you ever change to a new theme, you have to remember to re-install the code on the new theme. (Note: I’ve done this before and forgotten; the missed traffic information is unrecoverable.)
- If you want to track custom variables or include other settings different than the standard, you have to know how to alter the actual Analytics code you are given. For greenhorns, this can be tricky.
If you think any of these bullet points could possibly be an issue for you in the future, then a Google Analytics plugin is worth considering. There’s a need there, and you would be solving for a specific issue or issues.
But Wait — Do You Really Need a Plugin?
Now that you know you need assistance installing your Analytics code, there is actually one more question to ask before you head over to the WordPress plugin repository:
Does your theme have a built-in option to take care of Analytics code installation for you?
Many people do not realize that their theme — especially if it’s a premium framework like Genesis — usually has a place in the settings where you can install header and footer scripts.
If this option is available, simply copy the Analytics code into the section for header scripts.
This method eliminates one potential problem from above (you don’t have to touch the PHP code) and partially eliminates another: so long as you only change child themes, but not theme frameworks, the Analytics code will always be installed properly. If you do decide to switch theme frameworks, however, make sure you remember to re-install your Analytics code.
But what about those folks who need to customize their Analytics code, to track pageviews by author?
I run Midwest Sports Fans on the Genesis Framework, so I could use the settings area to copy the script and be safe even if I change child themes; but would a plugin be better so I can easily customize the code options?
Yes, yes it would.
And once you get to this point, it’s all about choosing the right plugin.
Which Google Analytics Plugin Should I Use?
Google Analytics is a popular traffic program, so it should surprise no one that there is a plethora of plugins available for it. I have tried out a number of them over the years, but I always ended up coming back to one in particular:
Google Analytics for WordPress by Joost de Valk.
There are a number of reasons why I like this plugin and recommend it to anyone who needs one for Google Analytics. Here are the top five:
- Joost is among the most trusted plugin developers in the WordPress community.
- The plugin allows for one-click enabling of custom variable tracking such as Author Name, Single Category, Tags, and others.
- The newest version uses asynchronous tracking, which increases accuracy and load time.
- The plugin is integrated with the Google Analytics API, so it could not be easier to set up new sites.
- There is ecommerce tracking available for those would need it.
I have never had one negative issue with this plugin, and I use it on almost every site I run.
We’ll never recommend a plugin to you that we don’t trust.
The Big Picture
As we conclude this post, not only do you have an A+ recommendation for a Google Analytics plugin, but you should also understand the thought process to engage in any time you are contemplating using a plugin.
Ask these questions first:
- Is the issue I’m trying to solve or the functionality I’m trying to provide necessary?
- Do I need plugin-type help to find a solution?
- Does my theme have a built-in way to provide it?
If the first two answers are “Yes” and the final answer is “No” then you should grab a plugin.
Then do your homework, pick the best one, and confidently take the next step towards intelligently deploying WordPress plugins that work.