What are the best practices for logging referrers in HTML files when PHP parsing is disabled?

When PHP parsing is disabled in HTML files, you can still log referrers by using JavaScript to send the information to a server-side script that can handle the logging. This can be achieved by creating an AJAX request to a PHP script that will then log the referrer information. ```javascript <script> var referrer = document.referrer; // Get the referrer URL var xhr = new XMLHttpRequest(); // Create a new XMLHttpRequest object xhr.open('POST', 'log_referrer.php'); // Specify the PHP script to handle logging xhr.setRequestHeader('Content-Type', 'application/json'); // Set the content type xhr.send(JSON.stringify({referrer: referrer})); // Send the referrer information as JSON </script> ```