fixed second req
This commit is contained in:
parent
3a7f791fa9
commit
516b2addb6
@ -17,8 +17,8 @@ class Palantics_Tracking {
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
// Add the script to the header
|
||||
add_action('wp_head', array($this, 'add_tracking_script'), 10);
|
||||
// Remove the duplicate event listener
|
||||
// add_action('wp_head', array($this, 'add_tracking_script'), 10); // REMOVED
|
||||
|
||||
// Register REST API 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() {
|
||||
// This is now handled by the Loader class using wp_enqueue_scripts
|
||||
|
||||
// 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
|
||||
// This function is kept for backward compatibility but doesn't output anything
|
||||
// The pL() function call is now managed by the Loader class
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user