Sponsored Content
The Wayback Machine - https://web.archive.org/web/20220409055552/https://github.com/google/site-kit-wp/issues/88
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need an option to disable tracking logged in users #88

Closed
parasshah195 opened this issue Jul 1, 2019 · 10 comments
Closed

Need an option to disable tracking logged in users #88

parasshah195 opened this issue Jul 1, 2019 · 10 comments
Labels
P0 Type: Enhancement
Milestone

Comments

@parasshah195
Copy link

@parasshah195 parasshah195 commented Jul 1, 2019 •

Feature Description

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.

Proposed solution

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.

Acceptance criteria

  • In Analytics settings, display a checkbox: "Disable tracking for logged-in users"
  • Based on this, store an option 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)
  • By default the option should be the array including loggedinUsers (in other words, the checkbox would be checked at first)
  • If tracking is disabled for logged-in users, the functions that print out the snippet (both AMP and non-AMP) should check whether the user is logged in, and if so, bail before printing the snippet
  • the checkbox should only show up in Analytics settings, not in the Analytics setup flow

Implementation Brief

  • Add a new "Exclude from Analytics" section at the bottom of the Analytics settings
  • Add "Logged-in users" checkbox (unchecked by default)
    • The checked state should correlate to the presence of loggedinUsers in the settings.trackingDisabled array
  • Update the handleSubmit to include the new trackingDisabled key to be saved
  • Update the settings datapoint to ensure the key is included
  • Update unit tests
  • Update VRT - VRT: Editing Settings Module story will need to be approved as it displays the Analytics setup in settings context

Changelog entry

  • Add a checkbox to allow disabling Analytics tracking for logged-in users, and introduce a filter to adjust the behavior programmatically.
@jamesozzie jamesozzie added the Type: Enhancement label Jul 1, 2019
@jamesozzie
Copy link
Collaborator

@jamesozzie jamesozzie commented Jul 1, 2019

@Paras16699 Thanks for the suggestion. We will log this feature request for discussion.

@jonasjj
Copy link

@jonasjj jonasjj commented Jul 12, 2019

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.

@jdelia
Copy link

@jdelia jdelia commented Aug 16, 2019

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.

@jdelia
Copy link

@jdelia jdelia commented Nov 2, 2019

@felixarntz This is the issue we spoke about at WCUS. :)

@felixarntz felixarntz added P0 and removed Type: Feature labels Nov 5, 2019
@felixarntz felixarntz added this to the 1.0.3 milestone Nov 7, 2019
@tinkersprojects
Copy link

@tinkersprojects tinkersprojects commented Nov 8, 2019

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.

@felixarntz felixarntz removed this from the 1.0.3 milestone Nov 12, 2019
@felixarntz felixarntz added this to the 1.0.4 milestone Nov 12, 2019
@felixarntz
Copy link
Member

@felixarntz felixarntz commented Nov 17, 2019

IB ✅

@felixarntz felixarntz removed this from the 1.0.5 milestone Nov 17, 2019
@felixarntz felixarntz added this to the 1.0.5 milestone Nov 17, 2019
@felixarntz felixarntz assigned aaemnnosttv and unassigned felixarntz Nov 17, 2019
@tofumatt
Copy link
Collaborator

@tofumatt tofumatt commented Nov 21, 2019

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.

@tofumatt tofumatt removed their assignment Nov 21, 2019
@marrrmarrr
Copy link
Collaborator

@marrrmarrr marrrmarrr commented Nov 21, 2019

verified, lgtm

@Aviad-Herman
Copy link

@Aviad-Herman Aviad-Herman commented Mar 11, 2021

Is this issue closed?
because I can't find this checkbox in settings...
Can you send a screenshot?

@jamesozzie
Copy link
Collaborator

@jamesozzie jamesozzie commented Mar 11, 2021

@Aviad-Herman This specific issue is in relation to Analytics. You'll find this configuration at "Site Kit > Settings > Connected Services > Analytics > Edit", all from within your WordPress dashboard.

There is a separate issue you'll find below in relation to a similar configuration for AdSense, this should be available soon.
#2681

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 Type: Enhancement
Projects
None yet
Development

No branches or pull requests