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
Allow ability to select what user roles are excluded #1891
Comments
@scottshefler Thanks for your suggestion. Note that all features requested are periodically reviewed by our product team, however there is no ETA for it. |
Hi! Are there any news about this feature implementation? Do we at least have any action or filter available to hook into for now? |
@gerardreches This is currently being worked on and should be included in one of the upcoming plugin releases. In the meantime, you can always override the default behavior using the |
@Hazlitte there are two things we still need to add to the IB: changes required on the PHP side and a note that we need to hide the second switch if the first one is enabled as it is described in the AC:
|
Hi @eugene-manuilov, on reviewing the IB I spotted that I hadn't included the requirement to add and update the switch labels. I have now done that. I have also added the requirements to:
|
Thanks, @Hazlitte! IB ✔️ |
I have also updated the estimate to 7 since 11 seems to be too much. |
@Hazlitte / @eugene-manuilov I have a question about an edge case here, and another about the UI. The edge case is this:
At this point, should the (hidden) content creator switch be unchecked because it is now overridden? I.e. the array is now just Also, just a quick UI question regarding the text underneath the component - are we ok with something like this?: if ( trackingDisabled.includes( TRACKING_LOGGED_IN_USERS ) ) {
message = __( 'All logged-in users will be excluded from Analytics tracking.', 'google-site-kit' );
} else if ( trackingDisabled.includes( TRACKING_CONTENT_CREATORS ) ) {
message = __( 'Users that can write posts will be excluded from Analytics tracking.', 'google-site-kit' );
} else {
message = __( 'All logged-in users will be included in Analytics tracking.', 'google-site-kit' );
} |
@johnPhillips Yes, let's keep both values. The
Yes, looks good to me. |
@eugene-manuilov I wasn't sure how to actually test that the exclusion is working on my local environment - looking at the PHP tests, I think an opt-out script should be added to the HTML? |
QA Update: Fail ❌@johnPhillips the styling is a little off I've noticed. As you can see from the screenshot, there's a lot of white space around the This is more of a personal preference, but when the Verified:
|
Thanks @wpdarren I just followed the ACs and the IB:
But obviously the ACs were written a while ago, so if there was a particular reason for requiring the toggle on the right, that might not be the case now (CC @felixarntz). Anyway, I'm more than happy to adjust it if needed, just let me know what needs doing. 👍 |
That's a good point, I agree with your suggestion, @wpdarren. There is a slight chance of this control to be not noticed by the user if it is on the right with so much space in between. Unless there is a valid reason for this, it is better to keep the 2nd switch close to the 1st one. |
@johnPhillips I think the toggle should still be displayed on the right, but I agree that the spacing is off, it should be fixed, so that they are next to each other, instead of percentage-based or using a grid or so. |
@felixarntz Yes, no problem, as long as they both are close enough to be considered as one group of controls :) |
@eugene-manuilov @johnPhillips is this merged into |
@wpdarren just merged it. Please, try again 😄 |
QA Update: Pass ✅Verified:
|
When will this be released? |
@gerardreches it is planned to go into the next release. We are currently smoke testing and will hopefully push it for release next week. |
Hi team, thanks for adding this feature. I just wanted to ask whether 'Posts' include custom post types when excluding "Users that can write posts"? The concern I have is whether we are excluding public, non-creator users that can write (e.g.) reviews which currently sit as CPTs. Thanks! |
@limcolin Posts do include custom post types, meaning any such configurations would apply to a "Reviews" CPT. For queries such as this going forward you can reach out in the plugin support forums. Likewise if you have any further questions on this, feel free to open a support topic. |
Much appreciated for the info @jamesozzie thanks for responding - will check out the forums! |
Feature Description
Currently only allowed to enable/disable excluding logged-in users. If you enable it this will also exclude front-end user logins for membership type sites. It's obviously very important to be able to track these types of logged in users.
The plugin should loop through and return all user roles that are setup on the site with a checkbox option to select which roles to exclude.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
trackingDisabled
option needs to support a new possible valuecontentCreators
. If that value is enabled butloggedinUsers
is not, tracking should be disabled if the current user canedit_posts
(which is a WordPress capability every role except subscriber has).contentCreators
should appear right of the existing toggle forloggedinUsers
.loggedinUsers
toggle is enabled, thecontentCreators
toggle should not be visible. Only if it is disabled, thecontentCreators
toggle should be visible.loggedinUsers
technically includescontentCreators
, that is not a big deal since it should simply take precedence.Implementation Brief
includes/Modules/Analytics.php
and update theis_tracking_enabled
method to also set$disabled
to true if 'contentCreators' is in the option array and the user can edit posts (current_user_can( 'edit_posts' );
)assets/js/modules/analytics/components/common/TrackingExclusionSwitches.js
TRACKING_CONTENT_CREATORS
with the valuecontentCreators
trackingExclusionLabels
valuesTRACKING_LOGGED_IN_USERS
:All logged-in users
TRACKING_CONTENT_CREATORS
:Users that can write posts
<Switch>
component and update the code of the new one to useTRACKING_CONTENT_CREATORS
onClick
of the first<Switch>
toonChangeTrackLoggedInUsers
and the second one toonChangeTrackContentCreators
onChange
function toonChangeTrackLoggedInUsers
and modify it so that it adds and removesTRACKING_LOGGED_IN_USERS
depending on whether the checkbox is checked. e.g:onChangeTrackContentCreators
for the second<Switch>
component'sonClick
trackingDisabled
array does not containTRACKING_LOGGED_IN_USERS
stories/module-analytics-stories.js
stories/module-analytics-settings-stories.js
Test Coverage
AnalyticsTest.php
to test the change toincludes/Modules/Analytics.php
Visual Regression Changes
QA Brief
You will need to connect Analytics to your Site Kit install.
Exclude from Analytics
All logged-in users
is NOT checked, an additionalUsers that can write posts
switch is visibleAll logged-in users
is checked, theUsers that can write posts
is hiddenAll logged-in users
will take precedence.site-kit-wp/includes/Modules/Analytics.php
Line 1185 in b043daa
Changelog entry
The text was updated successfully, but these errors were encountered: