Looper Posted August 14, 2024 Share Posted August 14, 2024 (edited) Hello, whenever I update WHMCS, all template files are overwritten, causing me to lose my Analytics code each time, and I have to re-add it. I would like to add it using a hook, but I don't know how to write the hook. Could someone please help me? Thanks! Sample tracking code: <script defer src="https://analytics.mysite.xyz/script.js" data-website-id="8777878sad7878fsd5f4sd5f4"></script> EDIT: i am not using google analytics, i am using umami analytics.. Edited August 14, 2024 by Looper 0 Quote Link to comment Share on other sites More sharing options...
bear Posted August 14, 2024 Share Posted August 14, 2024 1 hour ago, Looper said: whenever I update WHMCS, all template files are overwritten You don't edit the templates that came with it, you create your changes in a template set *based* on that, giving it a new folder. Updates won't rewrite those, and then you just need to be sure nothing in the new ones needs bringing into the one you made. 0 Quote Link to comment Share on other sites More sharing options...
Looper Posted August 14, 2024 Author Share Posted August 14, 2024 41 minutes ago, bear said: You don't edit the templates that came with it, you create your changes in a template set *based* on that, giving it a new folder. Updates won't rewrite those, and then you just need to be sure nothing in the new ones needs bringing into the one you made. Sorry, but I didn't get you. 😕 Let me explain how I did it I edited the Templates > Theme > header.tpl file and added the tracking code under <head>. However, when I update WHMCS it always gets removed 0 Quote Link to comment Share on other sites More sharing options...
bear Posted August 14, 2024 Share Posted August 14, 2024 In the templates folder, create a new folder "MyTheme" (name is up to you). Copy the theme files in the WHMCS theme you're using into that folder (it only requires the ones you're changing, but all is ok too). So now you have: Templates > MyTheme > header.tpl and that's where you make changes. Once you're done, tell WHMCS what theme you want to use (in this case, MyTheme). It will look there first for your files. 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.