Joomla stores and utilizes session and cookies. Although there are a number of reasons why it must do such, yet some users may not like being tracked. So they prefer disabling the website cookies. In some countries before storing the cookie the website owners have to take a consent. This blog post will help you how to disable cookies for normal visitors in your Joomla.
Follow the easy step by step complete guide to disable Joomla cookies for your visitors. Modify two Joomla core files to disable Joomla Website Cookie.
Step 1
Using FTP or cPanel open the file : /libraries/src/Application/CMSApplication.php. Go to line number 166 and add if condition for whole code in method
public function checkSession() { if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){ // added condition $db = \JFactory::getDbo(); $session = \JFactory::getSession(); $user = \JFactory::getUser(); // ... rest code }
Step 2
After making the changes to the above file now open libraries/joomla/session/handler/native.php. Go to line number 229 add if condition for whole code in method like in above file.
private function doSessionStart() { if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){ // added condition // Register our function as shutdown method, so we can manipulate it register_shutdown_function(array($this, 'save')); // ... rest code } }
After completing, keep a backup of the two files as you may lose the changes after every Joomla update.
If you are looking for a permanent solution, then you can use Easy Cookie Alert Module. Easy Cookie Alert is a consent popup which asks user to store or not to store the browser cookies.
We have tested this on Joomla 3.8.x and works absolutely fine. It may not work on lower version of Joomla.
These are some of the most recommended ways to disable Joomla cookies when a normal visitor visits your website. So for improved user credibility you can afford not to preserve the cookies. It’s better if you find a more convenient and accepted method to track users, hit counts and other statistics.
If you are unable to disable Joomla cookies in your website, then recheck whether you have successfully carried out all the above steps. But still if you are facing any issues then you can contact us. Our support team will assist you in disabling the Joomla cookies from your Joomla run website or blog.