Skip to content
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

Enhance/6220 conditionally render ga4 metrics sk dashboard #6691

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions assets/js/modules/analytics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@ import { MODULES_ANALYTICS } from './datastore/constants';
import { SetupMain } from './components/setup';
import { SettingsEdit, SettingsView } from './components/settings';
import DashboardAllTrafficWidget from './components/dashboard/DashboardAllTrafficWidget';
import DashboardAllTrafficWidgetGA4 from './components/dashboard/DashboardAllTrafficWidgetGA4';
import DashboardOverallPageMetricsWidget from './components/dashboard/DashboardOverallPageMetricsWidget';
import { ModulePopularPagesWidget } from './components/module';
import DashboardOverallPageMetricsWidgetGA4 from './components/dashboard/DashboardOverallPageMetricsWidgetGA4';
import {
ModulePopularPagesWidget,
ModulePopularPagesWidgetGA4,
} from './components/module';
import { isFeatureEnabled } from '../../features';

export { registerStore } from './datastore';

const ga4ReportingEnabled = isFeatureEnabled( 'ga4Reporting' );

export const registerModule = ( modules ) => {
modules.registerModule( 'analytics', {
storeName: MODULES_ANALYTICS,
Expand All @@ -59,7 +67,9 @@ export const registerWidgets = ( widgets ) => {
widgets.registerWidget(
'analyticsAllTraffic',
{
Component: DashboardAllTrafficWidget,
Component: ga4ReportingEnabled
? DashboardAllTrafficWidgetGA4
: DashboardAllTrafficWidget,
width: widgets.WIDGET_WIDTHS.FULL,
priority: 1,
wrapWidget: false,
Expand All @@ -74,7 +84,9 @@ export const registerWidgets = ( widgets ) => {
widgets.registerWidget(
'analyticsOverallPageMetrics',
{
Component: DashboardOverallPageMetricsWidget,
Component: ga4ReportingEnabled
? DashboardOverallPageMetricsWidgetGA4
: DashboardOverallPageMetricsWidget,
width: widgets.WIDGET_WIDTHS.FULL,
priority: 3,
wrapWidget: false,
Expand All @@ -86,7 +98,9 @@ export const registerWidgets = ( widgets ) => {
widgets.registerWidget(
'analyticsModulePopularPages',
{
Component: ModulePopularPagesWidget,
Component: ga4ReportingEnabled
? ModulePopularPagesWidgetGA4
: ModulePopularPagesWidget,
width: widgets.WIDGET_WIDTHS.FULL,
priority: 4,
wrapWidget: false,
Expand Down
7 changes: 6 additions & 1 deletion assets/js/modules/search-console/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import { SettingsEdit, SettingsView } from './components/settings';
import DashboardPopularKeywordsWidget from './components/dashboard/DashboardPopularKeywordsWidget';
import SearchFunnelWidget from './components/dashboard/SearchFunnelWidget';
import SearchFunnelWidgetGA4 from './components/dashboard/SearchFunnelWidgetGA4';
import {
AREA_MAIN_DASHBOARD_CONTENT_PRIMARY,
AREA_MAIN_DASHBOARD_TRAFFIC_PRIMARY,
Expand All @@ -36,6 +37,8 @@ import { isFeatureEnabled } from '../../features';

export { registerStore } from './datastore';

const ga4ReportingEnabled = isFeatureEnabled( 'ga4Reporting' );

export const registerModule = ( modules ) => {
modules.registerModule( 'search-console', {
storeName: MODULES_SEARCH_CONSOLE,
Expand Down Expand Up @@ -64,7 +67,9 @@ export const registerWidgets = ( widgets ) => {
widgets.registerWidget(
'searchFunnel',
{
Component: SearchFunnelWidget,
Component: ga4ReportingEnabled
? SearchFunnelWidgetGA4
: SearchFunnelWidget,
width: [ widgets.WIDGET_WIDTHS.FULL ],
priority: 3,
wrapWidget: false,
Expand Down