There are too many Google Analytics plugins in the WordPress.org repository. By my count, there are 900:
When there are 900 results for "Google Analytics" in the official repository, it's safe to say we've failed all but the advanced user.
— Erick Hitter (@ethitter) April 14, 2016
When one of these plugins recently changed ownership and rebranded in a poorly-promoted way, I began looking for a new solution. Frustrated by both the volume of related plugins in the official repository, and their unending lists of features that I didn’t need, I did what many perturbed developers would: I wrote a custom solution.
Since I needed only the most-basic of Google Analytic’s tracking code, and already had a model to work from thanks to my Piwik instance, the effort took less time than it did to review options on WordPress.org and write this post. As I wasn’t using any of the fancy dashboards, and neither my sites nor their tracking codes change regularly, my 46-line
mu-plugin (78 including plugin headers) easily meets my needs.
While I’m sure that some of the 900 are excellent plugins, separating them from the rest is nearly impossible, as is meaningfully searching for a Google Analytics plugin with a specific feature. Fortunately, work is underway to address the repository’s current state: