capacitor-community / firebase-analytics

Enable Firebase Analytics for Capacitor Apps
MIT License
159 stars 63 forks source link

Question: What's the preferred approach to log e-commerce events? #156

Closed mariusbolik closed 1 year ago

mariusbolik commented 1 year ago

Hello,

thank you for this helpful plugin!

Is it possible to measure e-commerce events exactly like mentioned here: https://firebase.google.com/docs/analytics/measure-ecommerce Should I simply use logEvent method or is there any other preferred approach?

Regards, Marius

niraj65 commented 1 year ago

Hi Marius Bolik,

Did you got the way how to log E-commerce events as per given document. I have logged the events with log event function but Ecommerce object is not getting passed it shows Firebase error 20 how can overcome this issue. please let me know it will very appreciated.

Regards, Niraj Parte

mariusbolik commented 1 year ago

Hi Niraj,

I ended up using the plugin capacitor-firebase/analytics by @robingenz. It seems way better maintained than the community plugin.

Regards, Marius

niraj65 commented 1 year ago

Thank you Marius,

Just one doubt can we pass "ecommerce" object inside params object. can you give me any example code how to log ecommerce event that will be very helpful.

Regards, Niraj Parte

mariusbolik commented 1 year ago

Hi Niraj,

Example:

await FirebaseAnalytics.logEvent({
  name: 'purchase',
  params: {
    currency: 'USD',
    transaction_id: 'XYZ',
    value: 12.34
  }
});

Here you can find event names and params: https://developers.google.com/analytics/devguides/collection/ga4/reference/events?hl=en&client_type=gtag

niraj65 commented 1 year ago

Thanks Marius!

Regards, Niraj parte

On Tue, 11 Apr, 2023, 6:51 pm Marius Bolik, @.***> wrote:

Hi Niraj,

Example:

await FirebaseAnalytics.logEvent({ name: 'purchase', params: { currency: 'USD', transaction_id: 'XYZ', value: 12.34 }});

Here you can find event names and params: https://developers.google.com/analytics/devguides/collection/ga4/reference/events?hl=en&client_type=gtag

— Reply to this email directly, view it on GitHub https://github.com/capacitor-community/firebase-analytics/issues/156#issuecomment-1503342674, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMRD7IWZAK75KNXILU5HAELXAVLHBANCNFSM6AAAAAAVJHUQV4 . You are receiving this because you commented.Message ID: @.***>