-
Notifications
You must be signed in to change notification settings - Fork 137
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
Generate UUID v4 for telemetry ID #1693
Conversation
|
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.
It looks like if the UUID isn't set, it falls back to generate_telemetry_client_id
, which is good, but that value is not saved or persisted, so the value will change every request. We'll probably want to save the value if one doesn't exist.
uuid-is-not-persisted.mov
@blakewilson haha yeah I pushed a commit right before you posted! Nice catch. 😅 |
case 'telemetry_client_id': | ||
if ( $value ) { | ||
$settings[ $name ] = sanitize_text_field( $value ); | ||
} else { | ||
unset( $settings[ $name ] ); | ||
} | ||
break; | ||
|
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.
This is a duplicate of the enable_telemetry
case. But, it's very important we don't mess that one up, so I kept them separate in case we update one or the other.
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.
Nice, I've confirmed that worked and the telemetry id is now persisted.
One other small thing I noticed however. This is up to interpretation, but I noticed when telemetry is disabled, then enabled again, the telemetry id is re-generated. Should this be the case?
The telemetry id is meant to anonymously establish a given site, so in theory if someone has telemetry on, disabled it, then re-enables, to us it would look like 2 seperate sites 🤔
If this ID is missing from the $_POST data when the settings page is saved, it gets removed. This ensures it's always in the saved payload.
Good catch once again. This is because the uuid was not present in the |
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.
Awesome! Works great
* Create process telemetry rest route (#1684) * Create tests * [Merl-1281] Add extra Google Analytics variables to Faust (#1689) * Feat: Add block_editor_utils and app-router versions in telemetry events. * Chore: Added changeset * MERL-1343/MERL-1342: API rewrite to WP plugin vs GA (#1687) * Removed telemetry from the CLI and moved it into the Faust WordPress plugin. --------- Co-authored-by: Blake Wilson <[email protected]> Co-authored-by: John Parris <[email protected]> * MERL-1339: add WP notice for anonymous telemetry opt-in (#1690) * Added checkbox for 'Enable Faust Telemetry' * Added telemetry prompt to user page options * Add `enable_telemetry` and `telemetry_reminder` to `sanitize_faustwp_settings()` * Load telemetry callbacks file * test: confirm `show_telemetry_prompt()` is hooked to `admin_notices` * Sanitize telemetry reminder settings value by ensuring it's an integer * Test telemetry prompt behavior * test: confirm behavior of `should_show_telemetry_prompt()` * fix: adjust CSS button styles to not style buttons in the telemetry prompt * chore: adjust button classes and add aria-label attributes * Register, enqueue, and localize telemetry script * Register telemetry decision REST route * test: confirm telemetry script is registered * UX: Toggle checkbox on settings page to match user's decision. Since this happens over REST via JS and we don't reload the page, this provides a better UX. * test: confirm `should_show_telemetry_prompt()` returns false when telemetry disabled * chore: add changeset --------- Co-authored-by: John Parris <[email protected]> * Generate UUID v4 for telemetry ID (#1693) * chore: change test namespace from Unit to Integration * chore: fix test class name to match file name * fix: return 204 if telemetry not enabled * test: confirm behavior of `generate_telemetry_client_id()` * Support `telemetry_client_id` in settings sanitization function * test: confirm generated and saved id matches retrieved id. --------- Co-authored-by: Blake Wilson <[email protected]> --------- Co-authored-by: Blake Wilson <[email protected]> Co-authored-by: Theofanis Despoudis <[email protected]> Co-authored-by: Matthew Wright <[email protected]> Co-authored-by: Teresa Gobble <[email protected]>
Tasks
Description
Generates and saves a uuid for use with anonymous opt-in telemetry requests.
Testing
Check out this branch and do one or both of these:
get_telemetry_client_id()
and notice it returns a uuid.Note there is a uuid stored in
wp_options.faustwp_settings
.