Learn business growth with Google Analytics 4 › Forums › Google Analytics 4 › Managing Analytics Configuration for UA and GA4 Reporting › Reply To: Managing Analytics Configuration for UA and GA4 Reporting
-
Currently, as per the official Google Developers documentation, GA4 properties only support the Google Analytics Data API (previously called the App + Web properties API). The v4 Reporting API only works with Universal Analytics (UA) properties. There’s also no direct migration path from v4 to the Data API, as they have different structures and capabilities.
When working with both UA and GA4 reporting, you would have two different configurations. You could set up a conditional check within your PHP code that determines which set of configurations to use based on the property type. For the time being, it’s advisable to maintain your Universal Analytics Property alongside your GA4 Property, so you might need to dual-tag your site and compromise by using two separate libraries, one for each GA version, within your analytics.php file.
Also, note that to use the Google Analytics Data API, you’ll either have to use Google’s client library (which supports PHP) or make HTTP requests to the API directly. However, I recommend watching Google’s updates closely as they are evolving their GA4 support.