Class "Google\Analytics\Data\V1beta\BetaAnalyticsDataClient" not found

Created on 22 January 2025, about 2 months ago

Problem/Motivation

When enabling or using the Google Analytics module, a fatal error appears:
Class "Google\Analytics\Data\V1beta\BetaAnalyticsDataClient" not found.
Previously, this class was part of Google's Analytics Data API Client Libraries.
However, after upgrading the google/analytics-data library, the class
has moved and now needs to be referenced as
Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient. The module
code still references the old namespace, causing the autoloading error.

Steps to reproduce

  1. Install or update to a newer version of the google/analytics-data library, e.g., via Composer.
  2. Enable or use the Google Analytics module (e.g., visit its configuration page).
  3. Observe the fatal error in the logs or on screen:
    Class "Google\Analytics\Data\V1beta\BetaAnalyticsDataClient" not found.

Proposed resolution

  • Update the Google Analytics module to reference
    Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient instead
    of Google\Analytics\Data\V1beta\BetaAnalyticsDataClient.
  • Confirm that the module's composer.json (or documentation) accurately reflects the necessary version of google/analytics-data so the correct class is available.
  • Ensure any references, if present, are updated to match the new namespaced class.

Remaining tasks

  1. Review and test the patch to ensure it works as expected without introducing new issues.
  2. Merge the patch for future module releases.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇸🇦Saudi Arabia bamlhes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024