-
Notifications
You must be signed in to change notification settings - Fork 295
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
Handle changing the connected Analytics property #8180
Comments
I've moved this back to Backlog as the final in-progress changes to the design doc, relating to audience caching, will probably affect the AC for this one |
The audience caching aspect of the design doc has been sufficiently finalised, and I've moved this back to AC. |
I considered a few different approaches for this including creating a new REST endpoint, however the hooks approach seems to be to be the cleanest as it doesn't require adding Analytics specific logic to shared components like the module store or settings Footer component. |
@benbowler should this one be in IBR? |
@eclarke1 not quite, I discussed the IB here with @aaemnnosttv last thing on Friday. I need to review it and may make some updates before putting it to IBR. |
My discussion with @aaemnnosttv revolved around changing the dismissed item/prompt slug, adding the account and property ID so that they would naturally be invalidated by switching the account/property. The Starting a thread here with @techanvil to get your thoughts before I update the IB. |
Hi @benbowler, this would be a good solution if we did want to retain the state when the user reverts to the same property later. However, this is not actually the case. If the user reverts to the same property, we still want to re-show the Setup CTA Banner in order to allow them to re-setup the feature, and correspondingly show the setup success notifications once they have set it up again. We also want to re-show the Audience Creation Notice to give them another opportunity to create the SK audiences, and of course don't want to restore the "temporarily hidden" state of audiences as this would be confusing having set the feature up again. So, we still want to delete the dismissed items/prompts when switching/resetting the property, and AFAICT it wouldn't really help to prefix the keys as suggested. Definitely a good pattern to bear in mind for other situations but I don't think it would be applicable here. |
Hey @benbowler, thanks for drafting this IB. A few points to consider:
Hmm... This might be a bit of a redundant check as by the time
Non-authenticated users can also "temporarily hide" tiles and have their own audience settings, so we need a different approach to iterating the users for at least these values. Maybe, instead of reusing the get_users(
array(
'meta_key' => $this->user_options->get_meta_key( 'googlesitekit_audience_settings' ),
'meta_compare' => 'EXISTS',
'fields' => 'ID',
)
);
We don't want to delete the
The snippet doesn't look quite right here - aside from
We don't need a new action for this, we have the
Rather than using the |
Update to the above:
Upon reflection, I've realised this wouldn't give us all users we are interested in - users who have simply dismissed the initial setup banner, via the |
Leaving a note from the AS sync: Tom will speak with Evan about Ben's suggestions about this task, since it is touching the fundamental parts of the project. |
@techanvil I've reviewed the PR for this issue and the current state LGTM! During my review, I found that a part of the IB and its consequent implementation is not correct, the following part specifically:
I've mentioned about this in detail here and have changed this in the PR to correct it. In summary, to reset the In the spirit of DRY, I've not repeated the As I have made some significant changes to the PR, I'm assigning this issue to you for MR. Thanks! CC: @benbowler |
QA Update
|
Thanks @kelvinballoo, I've taken a look at your feedback.
That's correct, we have deliberately excluded this key from the reset logic. Once a secondary user has seen the introductory popup/banner for the feature, they have been introduced to it so don't need to see it again. We might want to think about this again during the bug bash but it's the specced behaviour for now at least.
You can verify this via the plugin UI by temporarily hiding the items, changing the property, then reconnecting the previous property and confirming that the items are no longer hidden. If you want to check it in the DB, you should check the
Thanks for flagging this. It's actually not as expected and required a followup to fix it, because we shouldn't be completely clearing the settings - we want to retain the user's choice for the Reviewing
This is as expected, yes - the Btw - you're correct with regard to the N => null mapping. It is possible to use the WP CLI on InstaWP to retrieve the mapped version of the data - it takes a little setting up, you need to go to https://app.instawp.io/commands, create a command which runs |
QA Update ✅Thanks @techanvil , noted on items 1, 2, 4 and 5. For ITEM 2, I've done a test as you suggested and the 'Temporarily Hidden' badge is not carried through after changing analytics property or disconnecting the Analytics module and adding back the Analytics property.
8180.item.2.480p.movOther items were also verified good : ✅
Moving ticket to Approval. |
Feature Description
Ensure the Audience Segmentation feature is effectively reset when changing the connected Analytics property.
Additionally:
See Analytics properties and selected audiences in the design doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
audienceSegmentationSetupComplete
flag should be cleared (see Implement the secondary user setup #8130).didSetAudiences
flag should be cleared for all users (see Implement the secondary user variants of the "no audiences" banner. #8577).Implementation Brief
Create the
Reset_Audiences
class for clearing the dataModules/Analytics_4/Reset_Audiences
, which follows the standard class pattern, passing/instantiating required dependencies in the constructor, and otherwise bootstrapping the instance in aregister
method.reset_audience_data
:switch_user
method to switch the user context (e.g. here):Dismissed_Prompts
->remove
for the slugaudience_segmentation_setup_cta-notification
.Dismissed_Items
->remove
for the slugsaudience-segmentation-add-group-notice
,audience_segmentation_setup_success_notification
,settings_visitor_groups_setup_success_notification
andaudience-segmentation-no-audiences-banner
.Dismissed_Items
->get
, usearray_filter
to find all of the items which have a slug that begins withaudience-tile-
and callDismissed_Items
->remove
on them (this removes the "temporarily hidden" audiences state).Audience_Settings
->merge
to set the userconfiguredAudiences
anddidSetAudiences
settings to their respective defaults ofnull
andfalse
.register
method, callAnalytics_4/Settings
->on_change
to set up a change handler.propertyID
value changes, callAnalytics_4/Settings
->merge
to set the following values to their defaults:availableAudiences
=>null
availableAudiencesLastSyncedAt
=>0
audienceSegmentationSetupComplete
=>false
availableAudiencesLastSyncedAt
from the existing call to reset settings inAnalytics_4
.Register an instance of
Reset_Audiences
Reset_Audiences
in theAnalytics_4::register
method.Test Coverage
QA Brief
googlesitekit.data.dispatch( 'core/user' ).dismissPrompt( 'audience_segmentation_setup_cta-notification' )
action in the Chrome console, only theaudience_segmentation_setup_cta-notification
prompt is reset in this work.googlesitekit.data.dispatch( 'core/user' ).dismissItem( '{SLUG}' )
action in the Chrome console, you can see a list of the items that this work should reset here. Note the wildcardaudience-tile-*
means any item slug that begins withaudience-tile-
should be reset by this work.Changelog entry
The text was updated successfully, but these errors were encountered: