public static void AddProgressionEvent(EGAProgressionStatus progressionStatus, string progression01, string progression02 /*, IDictionary<string, object> fields = null*/) { AddProgressionEvent(progressionStatus, progression01, progression02, "" /*, fields*/); }
public static void AddProgressionEvent(EGAProgressionStatus progressionStatus, string progression01, string progression02, string progression03, double score, bool sendScore, IDictionary <string, object> fields) { string progressionStatusString = ProgressionStatusToString(progressionStatus); // Validate event params if (!GAValidator.ValidateProgressionEvent(progressionStatus, progression01, progression02, progression03)) { //GAHTTPApi.Instance.SendSdkErrorEvent(EGASdkErrorType.Rejected); return; } // Create empty eventData JSONObject eventDict = new JSONObject(); // Progression identifier string progressionIdentifier; if (string.IsNullOrEmpty(progression02)) { progressionIdentifier = progression01; } else if (string.IsNullOrEmpty(progression03)) { progressionIdentifier = progression01 + ":" + progression02; } else { progressionIdentifier = progression01 + ":" + progression02 + ":" + progression03; } // Append event specifics eventDict["category"] = CategoryProgression; eventDict["event_id"] = progressionStatusString + ":" + progressionIdentifier; // Attempt double attempt_num = 0; // Add score if specified and status is not start if (sendScore && progressionStatus != EGAProgressionStatus.Start) { eventDict.Add("score", new JSONNumber(score)); } // Count attempts on each progression fail and persist if (progressionStatus == EGAProgressionStatus.Fail) { // Increment attempt number GAState.IncrementProgressionTries(progressionIdentifier); } // increment and add attempt_num on complete and delete persisted if (progressionStatus == EGAProgressionStatus.Complete) { // Increment attempt number GAState.IncrementProgressionTries(progressionIdentifier); // Add to event attempt_num = GAState.GetProgressionTries(progressionIdentifier); eventDict.Add("attempt_num", new JSONNumber(attempt_num)); // Clear GAState.ClearProgressionTries(progressionIdentifier); } // Add custom dimensions AddDimensionsToEvent(eventDict); // Add custom fields AddFieldsToEvent(eventDict, GAState.ValidateAndCleanCustomFields(fields)); // Log GALogger.I("Add PROGRESSION event: {status:" + progressionStatusString + ", progression01:" + progression01 + ", progression02:" + progression02 + ", progression03:" + progression03 + ", score:" + score + ", attempt:" + attempt_num + "}"); // Send to store AddEventToStore(eventDict); }
public static void AddProgressionEvent(EGAProgressionStatus progressionStatus, string progression01, string progression02, double score) { AddProgressionEvent(progressionStatus, progression01, progression02, "", score); }
public static void AddProgressionEvent(EGAProgressionStatus progressionStatus, string progression01, string progression02) { AddProgressionEvent(progressionStatus, progression01, progression02, ""); }
public static bool ValidateProgressionEvent(EGAProgressionStatus progressionStatus, string progression01, string progression02, string progression03) { if (progressionStatus == EGAProgressionStatus.Undefined) { GALogger.I("Validation fail - progression event: Invalid progression status."); return(false); } // Make sure progressions are defined as either 01, 01+02 or 01+02+03 if (!string.IsNullOrEmpty(progression03) && !(!string.IsNullOrEmpty(progression02) || string.IsNullOrEmpty(progression01))) { GALogger.I("Validation fail - progression event: 03 found but 01+02 are invalid. Progression must be set as either 01, 01+02 or 01+02+03."); return(false); } else if (!string.IsNullOrEmpty(progression02) && string.IsNullOrEmpty(progression01)) { GALogger.I("Validation fail - progression event: 02 found but not 01. Progression must be set as either 01, 01+02 or 01+02+03"); return(false); } else if (string.IsNullOrEmpty(progression01)) { GALogger.I("Validation fail - progression event: progression01 not valid. Progressions must be set as either 01, 01+02 or 01+02+03"); return(false); } // progression01 (required) if (!ValidateEventPartLength(progression01, false)) { GALogger.I("Validation fail - progression event - progression01: Cannot be (null), empty or above 64 characters. String: " + progression01); return(false); } if (!ValidateEventPartCharacters(progression01)) { GALogger.I("Validation fail - progression event - progression01: Cannot contain other characters than A-z, 0-9, -_., ()!?. String: " + progression01); return(false); } // progression02 if (!string.IsNullOrEmpty(progression02)) { if (!ValidateEventPartLength(progression02, true)) { GALogger.I("Validation fail - progression event - progression02: Cannot be empty or above 64 characters. String: " + progression02); return(false); } if (!ValidateEventPartCharacters(progression02)) { GALogger.I("Validation fail - progression event - progression02: Cannot contain other characters than A-z, 0-9, -_., ()!?. String: " + progression02); return(false); } } // progression03 if (!string.IsNullOrEmpty(progression03)) { if (!ValidateEventPartLength(progression03, true)) { GALogger.I("Validation fail - progression event - progression03: Cannot be empty or above 64 characters. String: " + progression03); return(false); } if (!ValidateEventPartCharacters(progression03)) { GALogger.I("Validation fail - progression event - progression03: Cannot contain other characters than A-z, 0-9, -_., ()!?. String: " + progression03); return(false); } } return(true); }
public static void AddProgressionEvent(EGAProgressionStatus progressionStatus, string progression01, string progression02, double score, IDictionary <string, object> customFields = null, bool mergeFields = false) { AddProgressionEvent(progressionStatus, progression01, progression02, "", score, customFields, mergeFields); }