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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悰 [firebase_analytics] Custom Parameters Assertions Break Enhanced E-Commerce Events #10629
Comments
/cc @russellwheatley for visibility. |
any update? |
Are you able to prove that a list shows up in the Firebase console? My investigation showed that they do not, and the Firebase documentation is pretty clear on that as noted in the PR. |
Yes, I am. await FirebaseAnalytics.instance.logEvent(
name: "purchase",
parameters: {
"items": data.products
.map(
(product) => {
"item_id": product.id,
"item_name": product.name,
"price": product.price.value,
"currency": product.price.currency.code,
"quantity": product.quantity,
},
)
.toList(),
"value": data.grandTotal.value,
"currency": data.grandTotal.currency.code,
"transaction_id": data.transactionId,
"shipping": data.shippingCost.value,
if (data.couponCode?.isNotEmpty == true) "coupon": data.couponCode,
if (data.firstMargin != null) "tnc_first_margin": data.firstMargin?.value,
if (data.secondMargin != null) "tnc_second_margin": data.secondMargin?.value,
},
); I can confirm you I can see data incoming to GA4: I would be more than happy using stock methods (e.g. logPurchase) but, as you can see, I need to pass extra data along with the event (e.g. On the other hand, it would not be a problem also to keep using |
It is also possible to add custom parameters to items, not just events. Interestingly Firebase documentation also has a Dart/Flutter code sample which is not possible with this plugin! https://firebase.google.com/docs/analytics/measure-ecommerce#item_custom_parameters |
The linked pull request works pretty well in production. Sadly I'm still searching the time to fill the checklist |
@muccy do you need help? |
Hello! My name is Fabricio, I'm part of the technology team at i-Cherry, a Google partner agency and official reseller of Google Analytics, and as an official partner we provide support to customers not only in implementation but in solving problems involving Analytics. Recently, our customers with flutter applications that use this plugin are having problems logging Ecommerce events with additional custom parameters. As @muccy mentioned an example of a purchase with additional parameters, this type of situation is very common, of needing to enrich the data with specific information about the customer's business, but with the current limitations placed, it is impossible to apply them in a friendly way. A very common practice among the clients we serve is the implementation of customized modules (classes) to centralize analytics tools in order to be reused in every application, and normally "logEvent" is used for its freedom to define the event and parameters according to need. I understand that the limitation has been implemented because arrays are not allowed in custom events, resulting in error 21 in firebase, but even with this error the information is recorded, discarding only the error, but it will not be an error if the event name is an expected standard event according to the official Google documentation (purchase, add_to_cart and others from ecommerce). Please, I ask you to review, at least the logEvent and leave it free for customization as needed, as I understand that this should be his proposal, removing the limitation that today only the flutter version of the SDK has. It is worth mentioning that GA4 (the current version of Google Analytics) is constantly evolving, and frequently receives relevant updates on events, and I understand that logEvent with less restrictions will allow the use of new features in the future to be used without the need for an update in the Flutter SDK code, as it is in the Java and Swift SDK. |
Hey @mvolpato, this morning I finally found the time to complete the PR checklist. Any help or opinion is great anyway. For example I keep having problems with melos + |
I do not know much about |
Thanks for the feedback, I'll take a look at this once I get a chance 馃檹 |
Hello @russellwheatley, have you had a chance to give the PR a look? |
Hi @russellwheatley , is there any way we can increase visibility of this issue? |
Sorry for the tardiness on this issue, the PR LGTM. For future reference, custom parameters can be sent with any event as documented here. Custom parameters can also be sent with Let me raise this with the Firebase team and, should they approve, I will look to get this merged. Thank you for your patience 馃檹 |
Bug report
Describe the bug
The version 10.1 of
firebase_analytics
plugin introduced an assertion to filter out lists from custom parameters (see: #9520). This change forces us to use stock methods (e.g.:logPurchase
) in order to track e-commerce events but we are not allowed to pass extra (legal) parameters to GA4.Expected behavior
To circumvent the restrictions of the stock methods I used to call
logEvent
with the proper event name and parameter keys.It should be useful to enrich stock
log*
methods with extra parameters to pass.The text was updated successfully, but these errors were encountered: