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).

Click Here To Download, It’s Free!

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):


premium whmcs themes

About The Author

Hello, my name is . I run Zomex.com and have a great passion for the web in general but more specifically web design & web hosting. I also enjoy helping others and do everything I can to provide the best support to Zomex customers.

View more posts (169) by



4 Comments.

  1. Steve Fowler - April 20th, 2012 -

    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!

    Reply

    • Jack Curtis - April 20th, 2012 -

      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

      Reply

  2. John - April 20th, 2012 -

    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

    Reply

    • Jack Curtis - April 20th, 2012 -

      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

      Reply

Leave a Reply!