Why do you load the Google Analytics tracking code in the footer? It needs to be in the header for proper tracking.
Hey dburton77,
Thank you for the inquiry.
It’s not necessarily required for the tracking code to be placed in the header, but if that’s what you need, you can add this code to the functions.php file.
function ava_move_tracking_code_to_head() {
remove_action( 'wp_footer', 'avia_print_tracking_code', 10000 );
add_action( 'wp_head', 'avia_print_tracking_code', 10 );
}
add_action( 'init', 'ava_move_tracking_code_to_head', 20 );
Best regards,
Ismael
Thank you, Ismael.
Will the theme function to disable GA tracking still work with this approach?