fixed second req

This commit is contained in:
Karl Breuer 2025-04-16 16:56:10 +02:00
parent 3a7f791fa9
commit 516b2addb6

View File

@ -17,8 +17,8 @@ class Palantics_Tracking {
* Constructor * Constructor
*/ */
public function __construct() { public function __construct() {
// Add the script to the header // Remove the duplicate event listener
add_action('wp_head', array($this, 'add_tracking_script'), 10); // add_action('wp_head', array($this, 'add_tracking_script'), 10); // REMOVED
// Register REST API endpoint // Register REST API endpoint
add_action('rest_api_init', array($this, 'register_rest_endpoint')); add_action('rest_api_init', array($this, 'register_rest_endpoint'));
@ -34,26 +34,11 @@ class Palantics_Tracking {
} }
/** /**
* Add tracking script to header * Add tracking script to header - KEPT FOR BACKWARD COMPATIBILITY BUT NOT USED
*/ */
public function add_tracking_script() { public function add_tracking_script() {
// This is now handled by the Loader class using wp_enqueue_scripts // This function is kept for backward compatibility but doesn't output anything
// The pL() function call is now managed by the Loader class
// Fallback for backward compatibility - will call pL() function
?>
<!-- Page Load Tracking Initialization -->
<script>
document.addEventListener("DOMContentLoaded", function() {
if (typeof pL === 'function') {
try {
pL();
} catch (error) {
console.error("Error in page load tracking:", error);
}
}
});
</script>
<?php
} }
/** /**