Adding Google Analytics to your WHMCS template
WHMCS have since released a official module that makes installing Google Analytics very easy making the following guide no longer required (unless you’re using a version under 4.5).
In this tutorial we’ll cover how to add Google Analytics to your WHMCS based website. This tutorial is aimed specifically at our premium WHMCS Theme but will work with any WHMCS template.
Firstly you’ll need to signup for Google Analytics, add your website and then you’ll be provided with some Javascript code:
Next you’ll need to wrap this code in {literal}{/literal} tags. These are specific tags for the template system that WHMCS runs on (Smarty) that basically tells the browser to run the code inside exactly how it is and don’t confuse it with WHMCS/smarty code (stops conflict). In short these are required for any inline Javascript/CSS used in WHMCS templates.
Once added your code should look like:
{literal}
{/literal}
Finaly to install your code open the following file:
/templates/YOUR_TEMPLATE/footer.tpl
and the code just before the following tag (at the bottom of the footer.tpl file):


Found this as a result of following you on Twitter.. Nice touch. Thanks for continually looking for even more ways to help your customers. Refreshing!
No problem Steve, I’m thinking of adding a forum so it’ll eventually be possible to search for previous answers. What do you think?
Jack
Hi Jack,
Thanks for your blog post. You may be interested to know about the following feature which is included with WHMCS 5.0 and later. It requires no additional coding as long as your footer.tpl contains the {$footeroutput} tag.
http://docs.whmcs.com/Google_Analytics
- John
Hello John,
Thanks for that.
All templates have the footer hookpoint installed so they’re good to go. I had no idea about the Google Analytics module, I’ll edit this guide now.
Jack