firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
201 stars 33 forks source link

[Question] how post a purchase log event? #1062

Open aminbarzegari opened 3 days ago

aminbarzegari commented 3 days ago

What is your question?

hi.

how post a purchase log event?

Firebase Unity SDK Version

11.8.1

Unity editor version

2022.3.16f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

Analytics

Other Firebase Component(s) in use

All

Additional SDKs you are using

No response

Targeted Platform(s)

Android

Unity editor platform

Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

aminbarzegari commented 3 days ago
            FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventPurchase, productId, (double) price);

this code not work for send detail and only a purchase event without details.

argzdev commented 3 days ago

Hey @aminbarzegari, thanks for reporting. Upon testing with our Firebase Unity Quickstart with Firebase Analytics version 12.1.0, I tried adding the code snippet below:

public void AnalyticsPurchase()
    {
      DebugLog("Logging a purchase event.");
      FirebaseAnalytics.LogEvent(
        FirebaseAnalytics.EventPurchase,
        "RandomProductId",
        14.99
      );
    }

So far I'm not encountering the issue you've mentioned. Using the Debug View shows that the event has been captured with the provided details.

Screenshot 2024-07-05 at 11 49 40 PM

Could you try using the latest version of the SDK version 12.1.0? You can try using the DebugView to investigate the events being logged. If you're using Android, you're going to need to execute this command through the terminal adb shell setprop debug.firebase.analytics.app com.google.firebase.unity.analytics.testapp, this will track and events in the DebugView that are being logged.

Let me know if this helps. Thanks!

aminbarzegari commented 3 days ago
            Parameter[] purchaseParam =
            {
                new Parameter(FirebaseAnalytics.ParameterTransactionId, productId),
                new Parameter(FirebaseAnalytics.ParameterAffiliation, storType),
                new Parameter(FirebaseAnalytics.ParameterCurrency, "USD"),
                new Parameter(FirebaseAnalytics.ParameterValue, price),
                new Parameter(FirebaseAnalytics.ParameterPrice, price),

            };

                        FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventPurchase, purchaseParam);
argzdev commented 3 days ago

Hey, @aminbarzegari, I used the code snippet you've provided, so far all these details are displayed in the DebugView.

public void AnalyticsPurchase()
    {
      DebugLog("Logging a purchase event.");

      Parameter[] purchaseParam =
      {
          new Parameter(FirebaseAnalytics.ParameterTransactionId, "productId"),
          new Parameter(FirebaseAnalytics.ParameterAffiliation, "storType"),
          new Parameter(FirebaseAnalytics.ParameterCurrency, "USD"),
          new Parameter(FirebaseAnalytics.ParameterValue, 14.99),
          new Parameter(FirebaseAnalytics.ParameterPrice, 14.99),
      };

      FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventPurchase, purchaseParam);
}
Screenshot 2024-07-06 at 1 14 51 AM

In order for us to investigate this further, you need to provide more information on what specific detail is not showing.