public void TestFloatorInt() { GoedleUtils g_utils = new GoedleUtils(); Assert.IsFalse(g_utils.IsFloatOrInt("a1234")); Assert.IsFalse(g_utils.IsFloatOrInt("0x1234")); Assert.IsTrue(g_utils.IsFloatOrInt("1234")); Assert.IsTrue(g_utils.IsFloatOrInt("12.34")); }
public void trackGoogleAnalytics(string event_name, string event_id, string event_value, string type) { if (string.IsNullOrEmpty(event_name)) { throw new ArgumentNullException(); } // the request body we want to send var postData = new Dictionary <string, string> { { "v", GoedleConstants.GOOGLE_MP_VERSION.ToString() }, { "av", _app_version }, { "an", _app_name }, { "tid", _ga_tracking_id }, { "cid", _user_id }, { "t", type }, { "ec", getSceneName() }, { "ea", event_name }, //{"ul", this.locale}, }; // This is the Event label in Google Analytics if (!String.IsNullOrEmpty(event_id)) { postData.Add("el", event_id); } if (_goedleUtils.IsFloatOrInt(event_value)) { postData.Add("ev", event_value); } if (!String.IsNullOrEmpty(_anonymous_id)) { postData.Add("uid", _user_id); // For mapping after identify // Otherwise we will lost the old client id postData.Remove("cid"); postData.Add("cid", _anonymous_id); } if (_cd_event == "group" && event_name == "group" && _cd1 != 0 && _cd2 != 0 && _cd1 != _cd2) { postData.Remove("el"); postData.Remove("ev"); postData.Add(String.Concat("cd", _cd1), event_id); postData.Add(String.Concat("cd", _cd2), event_value); } _gio_http_client.sendGet(buildGAUrlDataString(postData), _gwr, _staging); }