Search Unity

Question Error 404 on uploading events

Discussion in 'Unity Analytics' started by dyyonisio, Jan 12, 2023.

  1. dyyonisio

    dyyonisio

    Joined:
    Dec 9, 2020
    Posts:
    2
    Hi!

    I'm learning to use unity services and I'm trying to put analytics in my application, but I always come across Error 404.

    I think it must be something simple I missed. Sorry :/

    upload_2023-1-12_15-23-30.png

    upload_2023-1-12_15-23-50.png
     
  2. dyyonisio

    dyyonisio

    Joined:
    Dec 9, 2020
    Posts:
    2
    Code (CSharp):
    1. using Unity.Services.Analytics;
    2. using Unity.Services.Core;
    3. using UnityEngine;
    4.  
    5. namespace Sandbox.ThirdParty.DyoSDK.UnityAnalytics.Scripts
    6. {
    7.     public class InitUnityAnalytics : MonoBehaviour
    8.     {
    9.         async void Start(){
    10.             var consentIdentifier = "";
    11.             var isOptInConsentRequired = false;
    12.  
    13.             try
    14.             {
    15.                 await UnityServices.InitializeAsync();
    16.                 var consentIdentifiers = await AnalyticsService.Instance.CheckForRequiredConsents();
    17.                 if (consentIdentifiers.Count > 0)
    18.                 {
    19.                     consentIdentifier = consentIdentifiers[0];
    20.                     isOptInConsentRequired = consentIdentifier == "pipl";
    21.                 }
    22.                 if (isOptInConsentRequired)
    23.                 {
    24.                     AnalyticsService.Instance.ProvideOptInConsent(consentIdentifier, false);
    25.                 }
    26.             }
    27.             catch (ConsentCheckException e)
    28.             {
    29.                 Debug.Log("Error reason = " + e.Reason.ToString());
    30.             }
    31.         }
    32.     }
    33. }
     
  3. RandolfKlemola

    RandolfKlemola

    Unity Technologies

    Joined:
    May 1, 2020
    Posts:
    130
    Hi dyyonisio,

    Thanks for reaching out! Is this issue still occurring? Is this then only analytics code you have in your scripts? Are you trying to send any custom events?

    Thanks!
    Randy