Tagged: google analytics
Currently, the GA script is included in the BODY. For certain purposes (e.g. google webmaster validation) the GA script needs to be included in the HEAD instead. How can I move the GA script to be included in the HEAD instead of the BODY?
Hey fortuneRice!
Insert this code into the child theme functions.php file:
add_action('after_setup_theme','avia_move_google_analytics');
function avia_move_google_analytics(){
remove_action('wp_footer', 'avia_print_tracking_code');
add_action('wp_head', 'avia_print_tracking_code');
}
Regards,
Peter