creativemac Posted May 21, 2018 Share Posted May 21, 2018 Hey there folks Is there anyone here that is able to help me place a piece of javascript into whmcs? It's a cookie consent form from cookiebot thanks in advance Linda 0 Quote Link to comment Share on other sites More sharing options...
wp4all Posted May 22, 2018 Share Posted May 22, 2018 (edited) Hi Linda, what is your problem ? If you have got access to your WHMCS Folder it is very simple. Goto ../whmcs/templates/your template open there header.tpl add your code like here in row 13 should be in most cases in between the <head></head> Tags save all and test it !! If you need more information or help send me an Message. Greetings Christian Edited May 22, 2018 by wp4all 0 Quote Link to comment Share on other sites More sharing options...
nei Posted June 20, 2018 Share Posted June 20, 2018 On 22/05/2018 at 11:45 AM, wp4all said: Hi Linda, what is your problem ? If you have got access to your WHMCS Folder it is very simple. Goto ../whmcs/templates/your template open there header.tpl add your code like here in row 13 should be in most cases in between the <head></head> Tags save all and test it !! If you need more information or help send me an Message. Greetings Christian Hey Christian Thank you for that. I do however need to add an additional line of code to make this work correctly. Step 3 To enable prior consent, apply the attribute "data-cookieconsent" to cookie-setting script tags on your website. Set the comma-separated value to one or more of the cookie categories "preferences", "statistics" and "marketing" in accordance with the types of cookies being set by each script. Finally change the attribute "type" from "text/javascript" to "text/plain". Example on modifying an existing Google Analytics Universal script tag: Are you able to tell me where i find such a piece of code in the WHMCS files? Thank you for your help 0 Quote Link to comment Share on other sites More sharing options...
wp4all Posted June 21, 2018 Share Posted June 21, 2018 Hi nei, nowhere you have to copy the code from the cookie site, as it already stands above. Modifiy the script to your needs and past it in. You know that you need this passus only if you are using Google Analytics ? This is needed for the pre Opt in / out solution of the cookie. If you do not use Analytics you should change your cookie to normal conditions. Greetings Christian 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 21, 2018 Share Posted June 21, 2018 On 5/21/2018 at 09:56, creativemac said: Is there anyone here that is able to help me place a piece of javascript into whmcs? It's a cookie consent form from cookiebot rather than editing the header.tpl template (which you'll have to repeat after each WHMCS upgrade), it would be simpler to use an action hook... just create a .php file in /includes/hooks, and paste the code below into it (change the data-cbid value to whatever cookiebot tell you to use) - the hook will automatically add the code to the header - and it will still be there after you update WHMCS. <?php /** * Cookie Bar * @author brian! */ add_hook('ClientAreaHeadOutput', 1, function($vars) { return <<<HTML <script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="00000000-0000-0000-0000-000000000000" type="text/javascript" async></script> HTML; }); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.