• Jayden

    Member
    24 September 2022 at 9:08 pm

    I see you’re having some problems with your GA4 data for a specific page and you’re getting a 404 error. It seems like there’s a chance you might have missed a section in the migration guide about how to use the Data API without a client library. It’s really important to follow that properly to avoid errors.

    Looking at your code, it seems like the conversion to GA4 might not be complete. For instance, you’re still using a UA metric ga:medium and there’s also a viewId in your code, which shouldn’t be there.

    So, you might want to revisit the data API basics. The format for your POST request should look something like this:

    `
    POST https://analyticsdata.googleapis.com/v1beta/properties/GA4_PROPERTY_ID:runReport
    Authorization: Bearer [YOUR_ACCESS_TOKEN]
    Accept: application/json
    Content-Type: application/json
    {
    “dateRanges”: [{ “startDate”: “2020-09-01”, “endDate”: “2020-09-15” }],
    “dimensions”: [{ “name”: “country” }],
    “metrics”: [{ “name”: “activeUsers” }]
    }
    `
    Please double-check these points and hopefully, that should solve your problem!