#1 September 8, 2023 3:18pm

doon.mok
Member
Registered: May 6, 2015
Posts: 141

Bigtree 4.5.7 - can't connect to GA4

Hello,

I am trying to connect to GA4 on our dev website but getting the error below. What is odd though, it worked locally(Mamp) but not on our dev server. Locally, I updated BigTree by copy/paste core files. Server, I updated 4.5.7 through BigTree.


Fatal error: Uncaught Error: Class 'Google\Analytics\Data\V1beta\BetaAnalyticsDataClient' not found in /.../core/inc/bigtree/apis/google-analytics-4.php:30 Stack trace: #0 /.../core/inc/bigtree/apis/google-analytics-4.php(146): BigTreeGoogleAnalytics4->getClient() #1 /.../core/admin/modules/developer/analytics/set-property-id.php(5): BigTreeGoogleAnalytics4->testCredentials() #2 /.../core/admin/router.php(549): include('/home/rfucli5/d...') #3 /.../core/launch.php(78): include('/home/rfucli5/d...') #4 /.../site/index.php(3): include('/home/rfucli5/d...') #5 {main} thrown in /.../core/inc/bigtree/apis/google-analytics-4.php on line 30


Any suggestions?
Thanks

Doon

Offline

#2 September 9, 2023 9:03am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Bigtree 4.5.7 - can't connect to GA4

Did you run composer update on the server? You might not have the composer package for the Google Analytics API or your composer.json file might not be the latest one from BigTree 4.5.7.

Offline

#3 September 11, 2023 10:35am

doon.mok
Member
Registered: May 6, 2015
Posts: 141

Re: Bigtree 4.5.7 - can't connect to GA4

Tim, I did forget to run composer but after I ran composer update and tried again. Now a different error.

Composer.json file
{
    "require": {
        "aws/aws-sdk-php": "^3",
        "oyejorge/less.php": "v1.7.0.14",
        "ext-gd": "*",
        "ext-json": "*",
        "webonyx/graphql-php": "^14.3",
        "predis/predis": "^1.1",
        "psr/simple-cache": "^1.0",
        "mrclay/jsmin-php": "^2.4",
        "guzzlehttp/guzzle": "^7.4.5",
        "google/analytics-data": "^0.10.0"
    }
}

Error
Fatal error: Uncaught Error: Call to undefined function Google\Protobuf\Internal\bccomp() in /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php:961 Stack trace: #0 /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1302): Google\Protobuf\Internal\Message->convertJsonValueToProtoValue(2, Object(Google\Protobuf\Internal\FieldDescriptor), true) #1 /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1241): Google\Protobuf\Internal\Message->mergeFromArrayJsonImpl(Array, true) #2 /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1338): Google\Protobuf\Internal\Message->mergeFromJsonArray(Array, true) #3 /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(795): Google\Protobuf\Internal\Message->parseFromJsonStream(Object(Google\Protobuf\Internal\RawInputStream), true) #4 /.../ in /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php on line 961

Offline

#4 September 12, 2023 11:07am

doon.mok
Member
Registered: May 6, 2015
Posts: 141

Re: Bigtree 4.5.7 - can't connect to GA4

Tim,

I'm not sure what happened but I didn't get the above error anymore but kept on getting the error message "The Property ID you entered does not appear to be valid.". Its odd because it works fine locally but not on our server.
What I did was export/import bigtree_settings table to my local and added the google analytics information. Then exported/imported the table back to our dev website on the server and everything looks to be working.

Offline

#5 September 12, 2023 9:45pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Bigtree 4.5.7 - can't connect to GA4

Very strange! Are your local and remote using different versions of PHP?

Offline

#6 September 13, 2023 7:58am

doon.mok
Member
Registered: May 6, 2015
Posts: 141

Re: Bigtree 4.5.7 - can't connect to GA4

Same version, PHP 7.4.16.

Offline

#7 September 18, 2023 8:10am

doon.mok
Member
Registered: May 6, 2015
Posts: 141

Re: Bigtree 4.5.7 - can't connect to GA4

Tim,

I thought I fixed the error by export/importing the table but wasn't getting new data. I ran "composer update" again but was getting error below again. To fix this error, I needed bcmath PHP extension installed. After it was installed, I was successful to set up GA4 through bigtree. Also make sure cron.php and cron-run.php have execute permissions.

In case anyone else runs into this issue.


Fatal error: Uncaught Error: Call to undefined function Google\Protobuf\Internal\bccomp() in /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php:961 Stack trace: #0 /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1302): Google\Protobuf\Internal\Message->convertJsonValueToProtoValue(2, Object(Google\Protobuf\Internal\FieldDescriptor), true) #1 /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1241): Google\Protobuf\Internal\Message->mergeFromArrayJsonImpl(Array, true) #2 /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1338): Google\Protobuf\Internal\Message->mergeFromJsonArray(Array, true) #3 /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(795): Google\Protobuf\Internal\Message->parseFromJsonStream(Object(Google\Protobuf\Internal\RawInputStream), true) #4 /.../ in /.../vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php on line 961

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.