firebase-unity-sdk icon indicating copy to clipboard operation
firebase-unity-sdk copied to clipboard

[Question] how post a purchase log event?

Open aminbarzegari opened this issue 1 year ago • 4 comments

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 avatar Jul 05 '24 15:07 aminbarzegari

            FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventPurchase, productId, (double) price);

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

aminbarzegari avatar Jul 05 '24 15:07 aminbarzegari

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!

argzdev avatar Jul 05 '24 15:07 argzdev

            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);

aminbarzegari avatar Jul 05 '24 16:07 aminbarzegari

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.

argzdev avatar Jul 05 '24 17:07 argzdev

I'll go ahead and close this thread for now. Feel free to come back here once you have more details regarding the issue. Thanks!

argzdev avatar Jul 10 '24 09:07 argzdev