Skip to content

Remove analytics module from the codebase #7843

Closed
@zutigrm

Description

Feature Description

Some things will not be needed since feature flag is removed. For example provisioning scope, UAProperty, and some test cases in assets/js/modules/analytics/datastore/accounts.test.js

Existing jest tests should be revisited as well.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The analytics module which has by now become obsolete and replaced by analytics-4 should be entirely removed from the Site Kit plugin. This should include but may not be limited to:
    • The Modules\Analytics module class and all other classes in this namespace in PHP.
    • The modules/analytics datastore.
    • The analytics module on the client-side.

Implementation Brief

  • 7932 will remove most of the Analytics module related code, after it is merged, follow the AC to check if anything remained
  • Remove the pieces linked in the description
  • Check if any analytics components/modules/widgets counterpart are still present and remove them. Example AdminBarSessions should be replaced with AdminBarSessionsGA4, etc
  • Search for any remaining usage of MODULES_ANALYTICS store selector and replace it with MODULES_ANALYTICS_4
  • Remove assets/js/components/adminbar/common.stories.js and assets/js/components/wp-dashboard/common.stories.js
  • Search for modules/analytics/data/ through the codebase to identify presence of old Analytics route usage and update/remove the code accordingly

Test Coverage

  • In e2e plugin tests/e2e/plugins/module-setup-analytics-no-account.php, rename e2e/setup/analytics/account-created endpoint to e2e/setup/analytics-4/account-created. And replace its usage in e2e tests where applicable.
  • In tests/e2e/plugins/module-setup-analytics.php
    • Cleanup the remaining analytics routes, like properties-profiles, and profiles, but leave accounts-properties-profiles unless it was completely replaced by account-summaries, as at the time of writing we still use accounts from that response. If this is completely replaced, we can remove that endpoint too.
    • Remove the usage of these routes if they are still present. At the time of writing they are still used only in jest tests for accounts and account select.
  • Remove the usage of analytics/data/goals route from e2e tests, as it was used only by old analytics, GA4 does not have goals.
  • Remove analytics/data/report route from the e2e tests if still present
  • In .storybook/fetch-mocks.js, replace analytics with analytics-4
  • Replace any outstanding usage of MODULES_ANALYTICS store with MODULES_ANALYTICS_4 in stories and jest tests. Some of the files at the time of writing:
    • assets/js/components/ReportError.test.js
    • assets/js/components/ReportError.stories.js
    • assets/js/components/dashboard-sharing/DashboardSharingSettingsButton.stories.js
    • assets/js/components/dashboard-sharing/DashboardSharingSettings/index.stories.js
    • assets/js/components/notifications/GoogleTagIDMismatchNotification.stories.js
    • assets/js/components/notifications/WebDataStreamNotAvailableNotification.stories.js
    • assets/js/components/notifications/ZeroDataStateNotifications/index.stories.js

QA Brief

  • This PR removes the legacy analytics module. No specific checks are needed here. The SAM E2E testing should cover testing this.

Changelog entry

  • Remove the legacy analytics module (UA) from Site Kit.

Metadata

Assignees

No one assigned

    Labels

    P2Low priorityType: InfrastructureEngineering infrastructure & tooling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions