Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GA4 Importer doesn't import E-Commerce data - in contrast to UA #516

Open
obottek opened this issue Mar 23, 2024 · 4 comments
Open

GA4 Importer doesn't import E-Commerce data - in contrast to UA #516

obottek opened this issue Mar 23, 2024 · 4 comments

Comments

@obottek
Copy link

obottek commented Mar 23, 2024

Hi,

I'm just loading data of some Universal Analytics properties, including e-commerce details. Now I'm on my way to do the same with the GA4 properties. However in contract to the UA importer, the GA4 importer doesn't import so important information as e-commerce revenue, conversion rate and no products details at all. Also goal values look wrong. Except for the conversion rate, everything else was fine with the UA importer.

I also checked the GA4 Query Explorer and it looks all values are possible to fetch there.

Here is a query for product details:
{"dimensions":[{"name":"itemId"},{"name":"itemName"}],"metrics":[{"name":"itemRevenue"},{"name":"itemsPurchased"}],"dateRanges":[{"startDate":"2023-06-01","endDate":"2023-06-30"}]}

And the result:
{"dimensionHeaders":[{"name":"itemId"},{"name":"itemName"}],"metricHeaders":[{"name":"itemRevenue","type":"TYPE_CURRENCY"},{"name":"itemsPurchased","type":"TYPE_INTEGER"}],"rows":[{"dimensionValues":[{"value":"561020"},{"value":"NERF - Super Soaker XP100"}],"metricValues":[{"value":"499.782208"},{"value":"20"}]}],"rowCount":243,"metadata":{"schemaRestrictionResponse":{},"currencyCode":"EUR","timeZone":"Europe/Berlin"},"kind":"analyticsData#runReport"}

Query for E-Commerce Purchases, Revenue and Session Conversion Rate:
{"metrics":[{"name":"ecommercePurchases"},{"name":"purchaseRevenue"},{"name":"sessionConversionRate"}],"dateRanges":[{"startDate":"2023-06-01","endDate":"2023-06-30"}],"limit":"1"}

Result:
{"metricHeaders":[{"name":"sessionConversionRate","type":"TYPE_FLOAT"}],"rows":[{"metricValues":{"metricHeaders":[{"name":"ecommercePurchases","type":"TYPE_INTEGER"},{"name":"purchaseRevenue","type":"TYPE_CURRENCY"},{"name":"sessionConversionRate","type":"TYPE_FLOAT"}],"rows":[{"metricValues":[{"value":"259"},{"value":"13669.916495000001"},{"value":"0.014340291235258292"}]}],"rowCount":1,"metadata":{"schemaRestrictionResponse":{},"currencyCode":"EUR","timeZone":"Europe/Berlin"},"kind":"analyticsData#runReport"}

That should be possible to request and process, right?

It would be great to have this build into the importer soon, because as of 1st July 2024, only GA4 properties hold data and also they only keep 14 month. So time to transfer runs out.

I'm on Matomo 5.0.3 and GoogleAnalyticsImporter plugin 5.0.12.

Greetings,
Olaf

@obottek obottek changed the title GA4 Importer doesn't import E-Commerce data - in contract to UA GA4 Importer doesn't import E-Commerce data - in contrast to UA Mar 24, 2024
@obottek
Copy link
Author

obottek commented Mar 24, 2024

I just see that the E-Commerce part is outcommented in the GA4 importer and that the code still has the ua attribute names. Maybe this could be updated to the ones I have given above?

Greetings,
Olaf

@obottek obottek closed this as completed Mar 24, 2024
@obottek obottek reopened this Mar 24, 2024
@snake14
Copy link
Contributor

snake14 commented Mar 24, 2024

Hi @obottek . Thank you for taking the time to create this issue. It does indeed look like version 4.4.8 of the plugin removed the itemRevenue and itemsPurchased metrics due to incompatibility. I'll mark this issue to be reviewed and prioritised by our Product team.

@snake14 snake14 added this to the For Priortisation milestone Mar 24, 2024
@AltamashShaikh
Copy link
Contributor

@obottek If you replace the code in plugins/GoogleAnalyticsImporter/Google/GoogleGA4MetricMapper.php with the content from this URL and start a new import, does that work for you ?

@AltamashShaikh
Copy link
Contributor

I just tried it and this still doesn't work.

Google Analytics returned an error: {
    "message": "Please remove itemRevenue and itemPurchaseQuantity to make the request compatible for example. The request's dimensions & metrics are incompatible. To learn more, see https:\/\/ga-dev-tools.web.app\/ga4\/dimensions-metrics-explorer\/",
    "code": 3,
    "status": "INVALID_ARGUMENT",
    "details": []
}
INFO      [2024-07-30 06:31:21] 1415150  Unexpected Error: Matomo\Dependencies\GoogleAnalyticsImporter\Google\ApiCore\ApiException: {
    "message": "Please remove itemRevenue and itemPurchaseQuantity to make the request compatible for example. The request's dimensions & metrics are incompatible. To learn more, see https:\/\/ga-dev-tools.web.app\/ga4\/dimensions-metrics-explorer\/",
    "code": 3,
    "status": "INVALID_ARGUMENT",
    "details": []
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants