Easily add Google Analytics code to MyBB with a plugin or with one template edit.
Google Analytics is free to use and provides invaluable historical data on visitors. It’s the most popular analytic tool among webmasters for this reason.
Get a Google Analytic account (duh)
Google’s get started with analytics page is the best place to be if you want an account but don’t know how to get one. I won’t waste your time by re-hashing what they say.
Use a plugin
Pick your poison below. Both do the same thing and the only major difference is compatibility.
- Google Analytics – This plugin is created by jugentiner and works with MyBB 1.8 (latest version at time of this post)
- Google Analytics – This plugin is created by querschlaeger and works with MyBB 1.4 & 1.6
Manually edit templates
For those that love good old edits, find the footer template of the theme you would like to add the GA code to.
If you’re working with the default template it’s here:
Home » Template Sets » Default Templates » Edit Template: footer
Your GA code should look like this:
Then add the code to the end of your footer template.
Boom. You’re done.
Footer or Header?
Some people are concerned that Google Analytics code is render-blocking. Meaning, it can block the rest of the page from loading before the browser is done loading GA.
For those that have Universal Analytics, you can pretty much place it anywhere on the page. Those that have old, classic, code should load the code at the bottom of the footer like we went over above.