Add Google Analytics manually, or use a plug-in?

Our situation is that we only dabble with WordPress, however one of our WordPress customers wishes to add Google Analytics to his site.

I’m assuming we can do this manually, relatively easily. And our instincts would be to go down that route. The customer is only small scale and won’t need to do anything especially sophisticated, at least at this stage.

Read More

We want to keep this simple. Is it best to avoid a plugin?

Update

Thanks for all the great answers- in the end we did use a plug-in. As promised by the experts who answered below it was super straightforward.

Related posts

Leave a Reply

4 comments

  1. I’d suggest either a plug-in or a drop-in section of code in your client’s functions.php file. The advantage of a drop-in is that you can add it once and never have to worry about activating or managing the system once it’s up-and-running.

    Here’s a quick explanation of how to add the Google tracking code to your theme’s functions.php file. The code itself will be automatically added to the footer of every page, archive, and post. This is essentially what a plug-in will do, without requiring you to activate/administer the system within the WordPress UI.

    Alternatively, you could use Google Analytics for WordPress to do the same thing within the UI.

    The choice between plug-in or drop-in is entirely up to you. A drop-in takes about 10 seconds to add with copy-paste. A plug-in takes only slightly longer. The actual setup process within Google Analytics to get your tracking code will take longer than either approach.

  2. I suggest a plugin. As others have already argued on this site, custom code is asking for disaster on WP. When you use a plugin you have a ready made path to upgrades and enhancements. Avoiding customization of the WP core is critical and I have seen better results waiting for an enhancement than forcing it.