Defer is messing up Google Tag Manager script

[ad_1]

Hello @guyinpv

The reason why you can not find the script in the exclusion list is that the Google tag is added as an inline script. According to the ID of the script, you are using the Google Sitekit plugin. I was able to recreate the issue and reported it to our developers.

In the meantime, you should be able to exclude the script by adding the following filter to the functions.php of the active theme:

add_filter( 'sgo_js_async_exclude', 'js_async_exclude' );
function js_async_exclude( $exclude_list ) {
	$exclude_list[] = 'google_gtagjs';

	return $exclude_list;
}

With this code added to functions.php, you can safely activate the “Defer Render-blocking JavaScript” feature.

Best Regards,
Kuzman Stoyanov

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer