-
Notifications
You must be signed in to change notification settings - Fork 799
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
Implement setOptOut
cookie command
#9085
Conversation
@jaswrks this PR is not passing some JS tests. Mostly due to an attempt to access |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me, looks good, except I have one question.
@@ -78,6 +79,7 @@ export const updateSetting = ( updatedOption ) => { | |||
error: error, | |||
updatedOption | |||
} ); | |||
maybeSetAnalyticsOptOut( updatedOption ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this getting set in the catch
block instead of in the success
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaswrks moving the tracking behaviour to somewhere on the react side of things (instead of on the redux action creator) would be a preferred solution for the problem I mentioned earlier.
@oskosk writes...
Thank you. I see what you mean. I reviewed the Travis output and I see this is a result of me importing Does anyone have a suggestion about how to best approach a fix for this and get tests to pass? Am I doing something really unexpected by importing the analytics code in this PR? Or is this missing |
Copy that :-) Ty |
da1219f
to
bc3d5c4
Compare
A potentially better alternative now exists in #9156 |
Closing, superseded by #9156 |
NOTE: Please consider merging #9156 instead of this.
PR Objectives
Implement the upcoming
setOptOut
command; i.e., whenever the new privacy option is changed, this PR will set or unset the opt-out cookie usingwindow._tkq.push( [ 'setOptOut', true|false ] )
Make
Jetpack_Tracks_Client
in PHP aware of this cookie too. If the opt-out cookie exists, do not record server-side events either.How to test:
Depends on Add new settings route and page for Privacy settings #8993 and Add/user tracking option api #9003These are merged already.localStorage.setItem( 'debug', 'dops:analytics' );
Pushing setOptOut: true|false
Blocker
This will not actually set the cookie, it merely logs what would occur if
setOptOut
existed. Therefore, this PR cannot be tested any further at this time. The work in gh-analytics-38 (setOptOut
command) needs to exist inw.js
as well, which I am investigating.Unresolved QuestionsWill the final option key for opt-outs in Jetpack remainYesjetpack_event_tracking
? This question has been raised in: p7kMJG-4rC-p2 and is pending further discussion.ShouldNosetOptOut
disable Google Analytics in addition to Tracks?