Skip to content

Commit

Permalink
use wp_head for themes/configurations that do not have a footer
Browse files Browse the repository at this point in the history
  • Loading branch information
diosmosis committed Jan 18, 2025
1 parent 567f54d commit 7c62532
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions classes/WpMatomo/Ecommerce/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function __construct( AjaxTracker $tracker, Settings $settings ) {

public function register_hooks() {
if ( ! is_admin() ) {
add_action( 'wp_footer', [ $this, 'on_print_queues' ], 99999, 0 );
$action = did_action( 'wp_head' ) ? 'wp_footer' : 'wp_head';
add_action( $action, [ $this, 'on_print_queues' ], 99999, 0 );
}
}

Expand All @@ -85,7 +86,7 @@ protected function should_track_background() {
return ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|| ( defined( 'REST_REQUEST' ) && REST_REQUEST )
|| $this->settings->get_global_option( 'track_mode' ) === TrackingSettings::TRACK_MODE_TAGMANAGER
|| did_action( 'wp_footer' );
|| ( did_action( 'wp_footer' ) && did_action( 'wp_head' ) );
}

protected function make_matomo_js_tracker_call( $params ) {
Expand Down

0 comments on commit 7c62532

Please sign in to comment.