Loading...

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="https://cdn.jsdelivr.net/ga-lite/latest/ga-lite.min.js" async></script>
	<script>
		var galite = galite || {};
		galite.UA = 'insert publisher id here';
	</script>
<?php 
}
add_action('wp_footer', 'google_analytics', 99);

Latest Posts

Portfolio

Contact

Fill in the form below to send us a message. Your details will not be used for promotional purposes or passed on to any third parties.

 

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close