Currently, it's logging the data for logged-in users to Analytics and Search Console which is skewing the data. I wouldn't want my own site visits to be logged in to Analytics and Console.
An option in the Settings page to exclude logged-in users.
A further granular control for specifying which roles to exclude would be more appreciated for people who only want to exclude Administrators / Editors, etc.
_Do not alter or remove anything below. The following sections will be managed by moderators only._
trackingDisabled which is an array (for future compatibility, see related #536) with or without the value loggedinUsers (i.e. the checkbox should probably have that as its value attribute)loggedinUsers (in other words, the checkbox would be checked at first)loggedinUsers in the settings.trackingDisabled arrayhandleSubmit to include the new trackingDisabled key to be savedsettings datapoint to ensure the key is includedVRT: Editing Settings Module story will need to be approved as it displays the Analytics setup in settings context@Paras16699 Thanks for the suggestion. We will log this feature request for discussion.
This is a necessity for websites with few readers. Without this option it's difficult to see if the increased traffic is because I've worked a lot recently, or because what I'm doing is attracting visitors.
This would be a very useful feature. We already have the option in the settings to remove the snippet, so adding a toggle to do that for logged in users or admins would be helpful. Even adding a filter where we could return false to remove the output. That way developers could create more complex filtering to remove it for anyone logged in except subscribers for example. If such a filter already exists, please let me know. My site is running AMP for all pages in Standard.
@felixarntz This is the issue we spoke about at WCUS. :)
I don't know if whats development has been happening with this but i think i have worked a temporary fix until a toggle switch can be made.
if you add the following script to a plugin or the theme's function.php file
function wpdocs_dequeue_script() {
if ( is_user_logged_in() ) {
wp_dequeue_script( 'google_gtagjs' );
}
}
add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );
for what i know and tested, it does work but don't know 100% what affect it will have on the site. It can be adjusted for just admins. Currently, it disables tracking for all logged-in users.
IB ✅
QA ✅
For both AMP and non-AMP sites the script is excluded when signed in and the "disable for logged-in users" is disabled. It still shows for anonymous users when that option is enabled.
It always appears when the option is disabled.
verified, lgtm
Most helpful comment
@felixarntz This is the issue we spoke about at WCUS. :)