예제 #1
0
        public static JSONObject GetSdkErrorEventAnnotations()
        {
            JSONObject annotations = new JSONObject();

            // ---- REQUIRED ---- //

            // collector event API version
            annotations.Add("v", new JSONNumber(2));

            // Category
            annotations["category"] = CategorySdkError;
            // SDK version
            annotations["sdk_version"] = GADevice.RelevantSdkVersion;
            // Operation system version
            annotations["os_version"] = GADevice.OSVersion;
            // Device make (hardcoded to apple)
            annotations["manufacturer"] = GADevice.DeviceManufacturer;
            // Device version
            annotations["device"] = GADevice.DeviceModel;
            // Platform (operating system)
            annotations["platform"] = GADevice.BuildPlatform;

            // type of connection the user is currently on (add if valid)
            string connection_type = GADevice.ConnectionType;

            if (GAValidator.ValidateConnectionType(connection_type))
            {
                annotations["connection_type"] = connection_type;
            }

            if (!string.IsNullOrEmpty(GADevice.GameEngineVersion))
            {
                annotations["engine_version"] = GADevice.GameEngineVersion;
            }

            return(annotations);
        }
예제 #2
0
        public static JSONObject GetEventAnnotations()
        {
            JSONObject annotations = new JSONObject();

            // ---- REQUIRED ---- //

            // collector event API version
            annotations.Add("v", new JSONNumber(2));
            // User identifier
            annotations["user_id"] = Identifier;

            // Client Timestamp (the adjusted timestamp)
            annotations.Add("client_ts", new JSONNumber(GetClientTsAdjusted()));
            // SDK version
            annotations["sdk_version"] = GADevice.RelevantSdkVersion;
            // Operation system version
            annotations["os_version"] = GADevice.OSVersion;
            // Device make (hardcoded to apple)
            annotations["manufacturer"] = GADevice.DeviceManufacturer;
            // Device version
            annotations["device"] = GADevice.DeviceModel;
            // Platform (operating system)
            annotations["platform"] = GADevice.BuildPlatform;
            // Session identifier
            annotations["session_id"] = SessionId;
            // Session number
            annotations.Add(SessionNumKey, new JSONNumber(SessionNum));

            // type of connection the user is currently on (add if valid)
            string connection_type = GADevice.ConnectionType;

            if (GAValidator.ValidateConnectionType(connection_type))
            {
                annotations["connection_type"] = connection_type;
            }

            if (!string.IsNullOrEmpty(GADevice.GameEngineVersion))
            {
                annotations["engine_version"] = GADevice.GameEngineVersion;
            }

#if WINDOWS_UWP
            if (!string.IsNullOrEmpty(GADevice.AdvertisingId))
            {
                annotations["uwp_aid"] = GADevice.AdvertisingId;
            }
            else if (!string.IsNullOrEmpty(GADevice.DeviceId))
            {
                annotations["uwp_id"] = GADevice.DeviceId;
            }
#endif

            // ---- CONDITIONAL ---- //

            // App build version (use if not nil)
            if (!string.IsNullOrEmpty(Build))
            {
                annotations["build"] = Build;
            }

            // ---- OPTIONAL cross-session ---- //

            // facebook id (optional)
            if (!string.IsNullOrEmpty(Instance.FacebookId))
            {
                annotations[FacebookIdKey] = Instance.FacebookId;
            }
            // gender (optional)
            if (!string.IsNullOrEmpty(Instance.Gender))
            {
                annotations[GenderKey] = Instance.Gender;
            }
            // birth_year (optional)
            if (Instance.BirthYear != 0)
            {
                annotations.Add(BirthYearKey, new JSONNumber(Instance.BirthYear));
            }

            return(annotations);
        }