namespace JustTrack { /// /// You can use this event to track all details related to the progression of the user in the game. /// public class JtProgressionEvent : AppEvent { /// /// Represents progression actions that can be tracked. /// public enum Action { /// /// Start action /// START, /// /// Complete action /// COMPLETE, /// /// Fail action /// FAIL, } private static string EncodeAction(Action pJtAction) { switch (pJtAction) { case Action.START: return "start"; case Action.COMPLETE: return "complete"; case Action.FAIL: return "fail"; default: return pJtAction.ToString().ToLowerInvariant(); } } /// /// Initializes a new instance of the class. /// /// The progression action. /// Optional first progression level. /// Optional second progression level. /// Optional third progression level. public JtProgressionEvent(Action pJtAction, string? pJtProgression1 = null, string? pJtProgression2 = null, string? pJtProgression3 = null) : this(EncodeAction(pJtAction), pJtProgression1, pJtProgression2, pJtProgression3) { } /// /// Initializes a new instance of the class with duration. /// /// The progression action. /// The duration value. /// The time unit for the duration. /// Optional first progression level. /// Optional second progression level. /// Optional third progression level. public JtProgressionEvent(Action pJtAction, double pDuration, TimeUnitGroup pUnit, string? pJtProgression1 = null, string? pJtProgression2 = null, string? pJtProgression3 = null) : this(EncodeAction(pJtAction), pDuration, pUnit, pJtProgression1, pJtProgression2, pJtProgression3) { } /// /// Initializes a new instance of the class. /// /// The progression action. /// Optional first progression level. /// Optional second progression level. /// Optional third progression level. public JtProgressionEvent(string pJtAction, string? pJtProgression1 = null, string? pJtProgression2 = null, string? pJtProgression3 = null) : base("jt_progression") { if (pJtAction != null) { this.AddDimension(Dimension.JT_ACTION, pJtAction); } if (pJtProgression1 != null) { this.AddDimension(Dimension.JT_PROGRESSION_1, pJtProgression1); } if (pJtProgression2 != null) { this.AddDimension(Dimension.JT_PROGRESSION_2, pJtProgression2); } if (pJtProgression3 != null) { this.AddDimension(Dimension.JT_PROGRESSION_3, pJtProgression3); } } /// /// Initializes a new instance of the class with duration. /// /// The progression action. /// The duration value. /// The time unit for the duration. /// Optional first progression level. /// Optional second progression level. /// Optional third progression level. public JtProgressionEvent(string pJtAction, double pDuration, TimeUnitGroup pUnit, string? pJtProgression1 = null, string? pJtProgression2 = null, string? pJtProgression3 = null) : base("jt_progression") { if (pJtAction != null) { this.AddDimension(Dimension.JT_ACTION, pJtAction); } if (pJtProgression1 != null) { this.AddDimension(Dimension.JT_PROGRESSION_1, pJtProgression1); } if (pJtProgression2 != null) { this.AddDimension(Dimension.JT_PROGRESSION_2, pJtProgression2); } if (pJtProgression3 != null) { this.AddDimension(Dimension.JT_PROGRESSION_3, pJtProgression3); } this.SetValue(pDuration, TimeUnitGroupConversions.ToUnit(pUnit)); } } /// /// You can use this event to capture details of items removed from the user's inventory. It could be either weapons or in-app currency. /// public class JtResourceEvent : AppEvent { /// /// Initializes a new instance of the class. /// /// The resource action. /// Optional item type. /// Optional item name. /// Optional item ID. public JtResourceEvent(string pJtAction, string? pJtItemType = null, string? pJtItemName = null, string? pJtItemId = null) : base("jt_resource") { if (pJtAction != null) { this.AddDimension(Dimension.JT_ACTION, pJtAction); } if (pJtItemType != null) { this.AddDimension(Dimension.JT_ITEM_TYPE, pJtItemType); } if (pJtItemName != null) { this.AddDimension(Dimension.JT_ITEM_NAME, pJtItemName); } if (pJtItemId != null) { this.AddDimension(Dimension.JT_ITEM_ID, pJtItemId); } } /// /// Initializes a new instance of the class with count. /// /// The resource action. /// The count value. /// Optional item type. /// Optional item name. /// Optional item ID. public JtResourceEvent(string pJtAction, double pCount, string? pJtItemType = null, string? pJtItemName = null, string? pJtItemId = null) : base("jt_resource") { if (pJtAction != null) { this.AddDimension(Dimension.JT_ACTION, pJtAction); } if (pJtItemType != null) { this.AddDimension(Dimension.JT_ITEM_TYPE, pJtItemType); } if (pJtItemName != null) { this.AddDimension(Dimension.JT_ITEM_NAME, pJtItemName); } if (pJtItemId != null) { this.AddDimension(Dimension.JT_ITEM_ID, pJtItemId); } this.SetValue(pCount, JustTrack.Unit.Count); } } /// /// Event that tracks and reports in-app purchase related details e.g. user selected some item from store, confirmed purchase, added to cart etc. In case of a successful purchase or subscription justtrack automatically tracks and reports the event so there is no need to generate that event. /// public class JtPurchaseEvent : AppEvent { /// /// Initializes a new instance of the class. /// /// The purchase action. /// The product ID. /// The product type. /// Optional token for the purchase. public JtPurchaseEvent(string pJtAction, string? pJtProductId, string? pJtProductType, string? pJtToken = null) : base("jt_purchase") { if (pJtAction != null) { this.AddDimension(Dimension.JT_ACTION, pJtAction); } if (pJtProductId != null) { this.AddDimension(Dimension.JT_PRODUCT_ID, pJtProductId); } if (pJtToken != null) { this.AddDimension(Dimension.JT_TOKEN, pJtToken); } if (pJtProductType != null) { this.AddDimension(Dimension.JT_PRODUCT_TYPE, pJtProductType); } } /// /// Initializes a new instance of the class with count. /// /// The purchase action. /// The product ID. /// The product type. /// The count value. /// Optional token for the purchase. public JtPurchaseEvent(string pJtAction, string? pJtProductId, string? pJtProductType, double pCount, string? pJtToken = null) : base("jt_purchase") { if (pJtAction != null) { this.AddDimension(Dimension.JT_ACTION, pJtAction); } if (pJtProductId != null) { this.AddDimension(Dimension.JT_PRODUCT_ID, pJtProductId); } if (pJtToken != null) { this.AddDimension(Dimension.JT_TOKEN, pJtToken); } if (pJtProductType != null) { this.AddDimension(Dimension.JT_PRODUCT_TYPE, pJtProductType); } this.SetValue(pCount, JustTrack.Unit.Count); } } /// /// You can use this event to capture details of an ad like load, click, show etc. Ad impressions are automatically tracked by justtrack SDK for integrated networks. For networks not integrated you can use forwardAdImpression(). /// public class JtAdEvent : AppEvent { /// /// Initializes a new instance of the class. /// /// The ad action. /// Optional ad bundle ID. /// Optional ad instance name. /// Optional ad network. /// Optional ad placement. /// Optional ad SDK. /// Optional ad segment. /// Optional ad unit. /// Optional ad test group. public JtAdEvent(string pJtAction, string? pJtAdBundleId = null, string? pJtAdInstanceName = null, string? pJtAdNetwork = null, string? pJtAdPlacement = null, string? pJtAdSdk = null, string? pJtAdSegment = null, string? pJtAdUnit = null, string? pJtAdTestGroup = null) : base("jt_ad") { if (pJtAction != null) { this.AddDimension(Dimension.JT_ACTION, pJtAction); } if (pJtAdBundleId != null) { this.AddDimension(Dimension.JT_AD_BUNDLE_ID, pJtAdBundleId); } if (pJtAdInstanceName != null) { this.AddDimension(Dimension.JT_AD_INSTANCE_NAME, pJtAdInstanceName); } if (pJtAdNetwork != null) { this.AddDimension(Dimension.JT_AD_NETWORK, pJtAdNetwork); } if (pJtAdPlacement != null) { this.AddDimension(Dimension.JT_AD_PLACEMENT, pJtAdPlacement); } if (pJtAdSdk != null) { this.AddDimension(Dimension.JT_AD_SDK, pJtAdSdk); } if (pJtAdSegment != null) { this.AddDimension(Dimension.JT_AD_SEGMENT, pJtAdSegment); } if (pJtAdUnit != null) { this.AddDimension(Dimension.JT_AD_UNIT, pJtAdUnit); } if (pJtAdTestGroup != null) { this.AddDimension(Dimension.JT_AD_TEST_GROUP, pJtAdTestGroup); } } /// /// Initializes a new instance of the class with duration. /// /// The ad action. /// The duration value. /// The time unit for the duration. /// Optional ad bundle ID. /// Optional ad instance name. /// Optional ad network. /// Optional ad placement. /// Optional ad SDK. /// Optional ad segment. /// Optional ad unit. /// Optional ad test group. public JtAdEvent(string pJtAction, double pDuration, TimeUnitGroup pUnit, string? pJtAdBundleId = null, string? pJtAdInstanceName = null, string? pJtAdNetwork = null, string? pJtAdPlacement = null, string? pJtAdSdk = null, string? pJtAdSegment = null, string? pJtAdUnit = null, string? pJtAdTestGroup = null) : base("jt_ad") { if (pJtAction != null) { this.AddDimension(Dimension.JT_ACTION, pJtAction); } if (pJtAdBundleId != null) { this.AddDimension(Dimension.JT_AD_BUNDLE_ID, pJtAdBundleId); } if (pJtAdInstanceName != null) { this.AddDimension(Dimension.JT_AD_INSTANCE_NAME, pJtAdInstanceName); } if (pJtAdNetwork != null) { this.AddDimension(Dimension.JT_AD_NETWORK, pJtAdNetwork); } if (pJtAdPlacement != null) { this.AddDimension(Dimension.JT_AD_PLACEMENT, pJtAdPlacement); } if (pJtAdSdk != null) { this.AddDimension(Dimension.JT_AD_SDK, pJtAdSdk); } if (pJtAdSegment != null) { this.AddDimension(Dimension.JT_AD_SEGMENT, pJtAdSegment); } if (pJtAdUnit != null) { this.AddDimension(Dimension.JT_AD_UNIT, pJtAdUnit); } if (pJtAdTestGroup != null) { this.AddDimension(Dimension.JT_AD_TEST_GROUP, pJtAdTestGroup); } this.SetValue(pDuration, TimeUnitGroupConversions.ToUnit(pUnit)); } } /// /// To capture all details related to user login events. /// public class JtLoginEvent : AppEvent { /// /// Initializes a new instance of the class. /// /// The login action. /// Optional login method. public JtLoginEvent(string pJtAction, string? pJtMethod = null) : base("jt_login") { if (pJtAction != null) { this.AddDimension(Dimension.JT_ACTION, pJtAction); } if (pJtMethod != null) { this.AddDimension(Dimension.JT_METHOD, pJtMethod); } } } }