So it turns out that using the recommended google analytics script is penalised by PageSpeed Insights as it is a render blocking script to load. After doing a bit of research I came across the ga-lite script. Here’s the function to whack it in the footer of a wordpress site. Code goes in functions.php.

function google_analytics(){  ?>
	<script src="" async></script>
		var galite = galite || {};
		galite.UA = 'insert publisher id here';
add_action('wp_footer', 'google_analytics', 99);

Leave a Reply

Privacy & more..

Cookie Consent Policy