Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Required to have a value for transactionName ERROR!

Discussion in 'Unity Analytics' started by MrBear666, Sep 18, 2022.

  1. MrBear666

    MrBear666

    Joined:
    Dec 6, 2021
    Posts:
    73
    Code (CSharp):
    1. Required to have a value for transactionName
    2. UnityEngine.Debug:LogError (object)
    3. Unity.Services.Analytics.AnalyticsServiceInstance:Transaction (Unity.Services.Analytics.TransactionParameters) (at Library/PackageCache/com.unity.services.analytics@4.1.0/Runtime/Events/Transaction/AnalyticsServiceInstance.Transaction.cs:19)
    4. UnityEngine.GUI:CallWindowDelegate (UnityEngine.GUI/WindowFunction,int,int,UnityEngine.GUISkin,int,single,single,UnityEngine.GUIStyle)
    5.  
    i am having this error when i click fake store buy button.

    There is one more subject about that bug but i couldnt see any solution. What should i do?
     
  2. Golcz

    Golcz

    Joined:
    Mar 17, 2020
    Posts:
    1
    Hello) Did you find the answer, I have the same error ...
     
  3. VaheNextEpic

    VaheNextEpic

    Joined:
    Oct 31, 2019
    Posts:
    1
    Same error.
     
  4. Laurie-Unity

    Laurie-Unity

    Unity Technologies

    Joined:
    Mar 5, 2020
    Posts:
    220
    Hi there,

    Most of the parameters on an event are optional, but there are certain parameters that are required in order for the event to provide meaningful data that you can then use to fine tune and imporve your game. In the case of the transaction event, the transactionName is required, by populating it you will be able to analyze your data and answer questions related to different products.

    You can view the details of each event and determine the names, type and requirement condition of each parameter within an event from the Analytics > Event Manager.

    upload_2022-11-11_9-5-46.png

    upload_2022-11-11_9-6-38.png

    upload_2022-11-11_9-7-5.png

    If you don't have a valid name for a transaction, you could set the transactionName to "UNKNOWN" or something like that, but don't leave it
    null
    as this will cause the event to fail validation as the expected parameter was missing.

    Here's some more information on manually recording a transaction event. If you are using the IAP plugin, it will send this event for you automatically.

    Code (CSharp):
    1.         var productsReceived = new Unity.Services.Analytics.Product()
    2.         {
    3.             Items = new List<Item>()
    4.             {
    5.                 new Item(){ ItemName = "Golden Battle Axe"      , ItemType = "Weapon", ItemAmount = 1},
    6.                 new Item(){ ItemName = "Flaming Sword"          , ItemType = "Weapon", ItemAmount = 1},
    7.                 new Item(){ ItemName = "Jewel Encrusted Shield" , ItemType = "Armour", ItemAmount = 1}
    8.         },
    9.             VirtualCurrencies = new List<VirtualCurrency>()
    10.         {
    11.             new VirtualCurrency(){ VirtualCurrencyName = "Gold", VirtualCurrencyType =VirtualCurrencyType.PREMIUM, VirtualCurrencyAmount = 100}
    12.         }
    13.         };
    14.  
    15.         var productsSpent = new Unity.Services.Analytics.Product()
    16.         {
    17.             RealCurrency = new RealCurrency() { RealCurrencyType = "USD", RealCurrencyAmount = 499 }
    18.         };
    19.  
    20.         AnalyticsService.Instance.Transaction(new TransactionParameters()
    21.         {
    22.             ProductsReceived = productsReceived,
    23.             ProductsSpent = productsSpent,
    24.             TransactionID = "100000576198248",
    25.             TransactionName = "IAP - A Large Treasure Chest",
    26.             TransactionType = TransactionType.PURCHASE,
    27.             TransactionServer = TransactionServer.APPLE,
    28.             TransactionReceipt = "ewok9Ja81............991KS=="
    29.         });
     
  5. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    To add to the above. To actually remove the error you need to make sure the title below is populated.

    upload_2022-12-14_13-27-6.png
     
  6. aspaltipis

    aspaltipis

    Joined:
    Sep 9, 2020
    Posts:
    2
    Solved with this simple step. Big thanks
     
    nobluff67 likes this.
  7. Jayesh_101

    Jayesh_101

    Joined:
    Sep 15, 2022
    Posts:
    9
    i am not using IAP Catalog then how to resolve it
     
  8. Laurie-Unity

    Laurie-Unity

    Unity Technologies

    Joined:
    Mar 5, 2020
    Posts:
    220
    @Jayesh_101

    If you are using the IAP plugin but aren't using the Services > In-App Purchaing > IAP Catalogue tool in the editor to populate the catalogue, you will instead need to populate the catalogue in code and provide your own button.

    e.g.
    Code (CSharp):
    1.  
    2.         // Manually add a couple of items to the store catalogue
    3.         var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    4.         builder.AddProduct("coins_500", ProductType.Consumable);
    5.         builder.AddProduct("coins_1000", ProductType.Consumable);
    6.  
    7.         // Initialize store
    8.         UnityPurchasing.Initialize(this, builder);
    9.  
    Code (CSharp):
    1.  
    2.     public void Coin500_Button_Clicked()
    3.     {
    4.         GameManager.Instance.Log("Attempting to buy 500 coins");
    5.         GameManager.Instance.iapManager.Purchase("coins_500");
    6.     }
    Code (CSharp):
    1.  
    2.     public void Purchase(string productId)
    3.     {
    4.         controller.InitiatePurchase(productId);
    5.     }

    The product id is case sensitive, it must match the product id you have added in your Google or Apple IAP definition in their store console.

    The transaction name, value, receipt, price etc.. will be populated in the transaction analytics event automatically, using values returned in the store response to your purchase.
     
    Last edited: Feb 11, 2023
  9. unity_45DB3F1A1BC52FC3A272

    unity_45DB3F1A1BC52FC3A272

    Joined:
    Dec 26, 2022
    Posts:
    1
    thanks man big help
     
    nobluff67 likes this.