Jump to content

Safe method for adding custom script tracking code


Recommended Posts

Hello all

I would like to be able to have a method that won't break my website to add custom script code into the header of my WHMCS instance.

The scripts are Facebook pixel and Google tag manager.
I have loaded google analytics using the add-on, which is working fine for a while now.

My issue is that when I add a script into the header.tpl, but when I do, it breaks the CSS of the site.
I found the following add-on which looks perfect and is exactly what I want, however, it has not been updated in  2 years. i have emailed the developer to ask about its compatibility - https://marketplace.whmcs.com/product/4067-add-to-header-and-footer

Without using the add-on above, what is the best, more sustainable way to <Script> code to WHMCS, such as Google Analytics, Google Tag Manager, and Facebook Pixel (site-wide for now)

I do not know how to add hooks, so if you are going to mention Hooks, please can you point me in the right direction. The hooks tutorials I have seen are for specific events/actions etc.

Thank you for a great community!

Link to comment
Share on other sites

23 minutes ago, spartanza said:

Without using the add-on above, what is the best, more sustainable way to <Script> code to WHMCS, such as Google Analytics, Google Tag Manager, and Facebook Pixel (site-wide for now)

using hooks. 🙂

24 minutes ago, spartanza said:

I do not know how to add hooks, so if you are going to mention Hooks, please can you point me in the right direction.

I posted a Facebook pixel hook over a year ago that uses a hook to inject the code into the header.

... someone else in that thread posted the basic facts of how to install the hook, e.g upload it to /includes/hooks - though i'd suggest checking that the actual Facebook code within the hook is still correct when compared to what FB currency gives as code to use.

29 minutes ago, spartanza said:

I found the following add-on which looks perfect and is exactly what I want, however, it has not been updated in  2 years. i have emailed the developer to ask about its compatibility - https://marketplace.whmcs.com/product/4067-add-to-header-and-footer

ultimately, that addon is just a quick way to enter code into admin/client header/footer sections using the relevant hooks, but if you already know the JS code or whatever you want to add to the page, then it's not difficult to add it to a hook, e.g the hook below is a cookie hook that I posted for someone...

once you have the code, then it's just a case of deciding whether it needs to go in the header / footer and then using the relevant hook.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated