How to add additional JavaScript code in WHMCS

Some time you need to add additional JavaScript code in header OR footer like Google Analytics, Facebook Pixel, Live Chat code etc., You can do it by below hook.

If you want add in head section use below code:

<?php
 
add_hook('ClientAreaHeadOutput', 1, function ()
{
    $jsCode = <<<EOT
add your js code here
EOT;
		
		return $jsCode;
});

?>

If you want add in footer section use below code:

<?php
 
add_hook('ClientAreaFooterOutput', 1, function ()
{
    $jsCode = <<<EOT
add your js code here
EOT;
		
		return $jsCode;
});

?>

You need to open any text editor like notepad, copy and paste above code in that and add your code in place of add your js code here then save it as .php extension for an example jsCode.php then upload this file in below location .

{WHMCS ROOT}/includes/hooks/

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

 How to move WHMCS to a another directory

There may have been occasions where you wanted to move your already installed copy of WHMCS to...