How to Install Google Tag Manager Code in WHMCS [Easy Way]

How to Install Google Tag Manager Code in WHMCS [Easy Way]

Tired of looking for a way to install google tag manager code in whmcs?

Well! Today, you’re at the right place where I am going to teach you how you can easily install any code in WHMCS

I recently started using WHMCS on WebVerge so that anyone who is looking for a domain and hosting they can get started and purchase hosting for me.

I wanted to enable cross-domain tracking and for that I need to install Google Tag Manager code on my WHMCS account.

But I didn’t know how to add any type of code in WHMCS. I was really a noob in this and didn’t understand anything.

I realised that not a lot of people are using WHMCS like WordPress and that’s the reason there are not a lot of tutorial which can help me to paste the code.

I did some research and I figured how I can add Google Tag Manager code in WHMCS.

Let’s get started and try to understand how to add the code.

This tutorial is for anyone who wants to paste any kind of code on their website.

Install Google Tag Manager on WHMCS

What is WHMCS?

WHMCS is for someone who wants to sell their own digital product license key or they want to sell their domain and hosting.

It’s a great software which helps you to automate your domain and hosting business with an ease.

If you’re someone who wants to learn more about google tag manager

How to Install Google Tag Manager Code in WHMCS

Install Google Tag Manager WHMCS
  • If you’re signing up for the first time then you need to enter all your personal information.
Install Google Tag Manager WHMCS
  • Once, you’re done with that you will get the code which you need to copy.
Install Google Tag Manager WHMCS
  • Go to your file manager where you have hosted WHMCS.
  • Then navigate to templates → Six (Your active theme) → footer.tpl and then edit the file.
  • You need to open the settings of your default theme it can be Six or it can be any other theme you have installed.
  • Open the file and go to the end of the code.
  • Then you add two these two lines before.
{/if}
{literal}
<! -- Add your custom code -->
{/literal}
  • If you’re done adding the code it will look something like this.
{/if}
{literal}
<!-- Google Tag Manager Head Code -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXX');</script>
<!-- End Google Tag Manager -->

<!-- Google Tag Manager Body Code (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
{/literal}
  • That’s it and this is how you can paste the Google tag manager code on WHMCS.

Frequently Asked Questions:

Can I paste Google Analytics Code?

Yes! You can paste any type of code using this method.

How to check the default theme of WHMCS?

You need to goto Settings General Settings Template and there you will know your default WHMCS theme name.

Can I paste any other code using this method?

Yes! You can paste any code using this method.

Conclusion:

When I started using WHMCS there were a lot of things which were confusing and for me it was difficult to understand.

I didn’t know how to edit the .tpl files but this tutorial worked for me to paste any type of code on yoru website.

If you want to paste the code you just need to add these two works and that is {/if} and {/literal}

This will help you to paste any type of code on your website.

If you face any issue while trying this method you can drop a comment below and I will help you out. I personally review and reply to the comments in 4 hours.

You can also check out more posts on WordPress and WebVerge if you’re interested in starting your first blog or website.

Share on:

I am the founder of WebVerge. I have 5+ years of experience in WordPress. I always write about the things I am obsessed with tech, WordPress, and SEO. I am also a Digital Marketing trainer at IIDE.

4 thoughts on “How to Install Google Tag Manager Code in WHMCS [Easy Way]”

    • Hey Mohammed,

      I have tried this trick multiple times and it has worked for me and I have tested it with the latest version of WHMCS and it works perfectlty.

      Reply

Leave a Comment