Closed scottshefler closed 3 years ago
@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 googlesitekit_analytics_tracking_disabled
filter, which expects a boolean.
@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:
If the loggedinUsers toggle is enabled, the contentCreators toggle should not be visible. Only if it is disabled, the contentCreators toggle should be visible.
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:
Analytics.php
fileThanks, @Hazlitte! IB :heavy_check_mark:
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:
["contentCreators"]
At this point, should the (hidden) content creator switch be unchecked because it is now overridden? I.e. the array is now just [ "loggedinUsers" ]
.
Or should we persist the checked state, i.e. the array is now ["contentCreators", "loggedinUsers"]
?
Hope that makes sense. I understand that "loggedinUsers"
probably overrides "contentCreators"
so perhaps it doesn't matter, but I wanted to check.
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' );
}
Or should we persist the checked state, i.e. the array is now ["contentCreators", "loggedinUsers"]?
@johnPhillips Yes, let's keep both values. The loggedinUsers
value will take precedence and contentCreators
will be ignored.
Also, just a quick UI question regarding the text underneath the component - are we ok with something like this?
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?
Let me know the specifics and I'll update the QAB. For now I've just put Verify that tracking exclusions are working as in the settings.
@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?
If you disable tracking for let's say content creators and your user can edit posts, then you shouldn't should see this line in the page source HTML code when you open a page on the frontend: https://github.com/google/site-kit-wp/blob/b043daa84e6a4f5166f52022e7a1c6d37d1feabb/includes/Modules/Analytics.php#L1185
Otherwise, this line should shouldn't be added to the page HTML markup.
Thanks @eugene-manuilov - QAB updated 👍
@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 Exclude from Analytics
text. In the latest release, the text and toggle are aligned to the left and have no white space.
This is more of a personal preference, but when the All logged-in users
toggle is disabled, and the Users that can write posts
toggle appears, it would be good for that to appear underneath, rather than to the side. This would mean the setting toggles are all displayed to the left. Not sure what @Pratheep-lab feels about that though?
Verified:
Users that can write posts
is enabled, then the script is active on the website. Users that can write posts
is disabled, then the script is not active on the website. Thanks @wpdarren
I just followed the ACs and the IB:
The toggle for contentCreators should appear right of the existing toggle for loggedinUsers.
Add mdc-layout-grid tags and classes to position the switches side by side on desktop and tablet and vertically on mobile
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 :)
Thanks for the feedback all. I've added a new PR which attempts to keep the layout (inline on desktop / tablet; stacked on mobile) but to reduce the gap between the switches. I hope this is ok - let me know if any further changes required.
Mobile | Tablet, desktop |
---|---|
@eugene-manuilov @johnPhillips is this merged into develop
branch yet? I'm not seeing the changes :)
@wpdarren just merged it. Please, try again :smile:
Verified:
Users that can write posts
is enabled, then the script is active on the website. Users that can write posts
is disabled, then the script is not active on the website. 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.Changelog entry