Check whether a post has Analytics data to determine whether to show admin bar menu #167
Comments
|
@lucymtc The implementation brief should contain information on how the filter in the
In order to properly handle that while still keeping the filters in isolation, potentially a single centralized filter in the core The implementation brief will furthermore need some adjustments after #312. We should consider this issue blocked by #312, and revisit the implementation brief once the work on that has been completed. |
|
@aaemnnosttv I really like the suggested abstraction, let's put that in place as part of this issue (this will clearly increase the size of this issue, but that's okay). IB This issue doesn't have super-high priority, let's just tackle it whenever we find some time for it after the critical bugs have been fixed. |
|
Tested Confirmed on pages without analytics data and no search console info the admin bar menu isn't displayed Confirmed alternate scenario of no SC data but with Analytics during testing of #314 Passed QA |




Current: Admin bar does not display if search console doesn't have stats.
Expected: G logo should appear in the admin bar and expand upon hover if there are stats from any modules (eg. Analytics). This should appear on the Front end and in the admin.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
If we have a situation where SC is "gathering data", GA stats are both zero, but we still show the Admin bar, that would be rather underwhelming for users.
(this screenshot is from the main dashboard, but the stats would look similar in the Admin bar)
Implementation Brief
Analytics specific
Add action
googlesitekit_show_admin_bar_menuin analytics module to check if analytics has data for the post, the same way search console callshas_data_for_post()https://github.com/google/site-kit-wp/blob/develop/includes/Modules/Search_Console.php#L578 in this hook,add similar method in Analytics module by requesting
overviewdatapoint with permalink argument and save result in transient.Update
delete_all_transients()in Reset.php to remove added transient when reseting Site Kit.Opportunity for abstraction (possibly separate ticket?)
Modules could be Admin bar aware, and able to inform the Admin Bar whether or not it is active for the current URL and thus better inform the Site Kit admin bar item if it should render or not.
Module_With_Admin_Barinterfacepublic is_active_in_admin_bar( $url ) : boolmethodwith_admin_bar() : Module[]method toModulesModuleinstances that are filtered to only those that implement theModule_With_Admin_Barinterfaceset_modules( $modules ) : voidmethod onAdmin_Barwhere$modules : Module_With_Admin_Bar[]Admin_BarinPlugin, pass the active modules to the instance\Google\Site_Kit\Core\Admin_Bar\Admin_Bar::is_active, check if any of the provided modulesis_active_in_admin_bar( $url )Changelog entry
The text was updated successfully, but these errors were encountered: