Hi @jamessui-1 thanks for getting in touch. There is no current built in way to achieve this but it can be done using a filter. If you were looking to disable Analytics for all pages on your site then you could use the following:
add_filter( ‘googlesitekit_analytics-4_tag_blocked’, ‘__return_true’ );
To disable Analytics on specific pages of your website then you can use the following:
add_filter( ‘googlesitekit_analytics-4_tag_blocked’, ‘restrict_analytics_snippet’ );
function restrict_analytics_snippet( $original ){
?// don’t place Analytics on page with ID of *
??if (is_page( * ) )
return true;
}
You will just need to replace the * with the page ID(s) you wish to disable Analytics for and the Site Kit Analytics code will not be placed on that page. This filter should ideally be added to a custom functions plugin or a child theme, rather than the main themes functions.php file (which would get overwritten on theme updates).
This filter can also be adapted for other posts, categories etc. but further customisation does fall out of the range of the support we can provide here. Hope this helps to answer your question.