public void track(string event_name, string event_id, string event_value, bool launch, string trait_key, string trait_value, IGoedleUploadHandler goedleUploadHandler) { if (!_adaptation_only) { bool ga_active = !String.IsNullOrEmpty(_ga_tracking_id); string authentication = null; string content = null; int ts = getTimeStamp(); // -1 because c# returns -1 for UTC +1 , * 1000 from Seconds to Milliseconds int timezone = (int)(((DateTime.UtcNow - DateTime.Now).TotalSeconds) * -1 * 1000); GoedleAtom rt = new GoedleAtom(_app_key, _user_id, ts, event_name, event_id, event_value, timezone, _app_version, _anonymous_id, trait_key, trait_value, ga_active); if (rt == null) { Console.Write("Data Object is None, there must be an error in the SDK!"); return; } else { content = rt.getGoedleAtomDictionary().ToString(); authentication = _goedleUtils.encodeToUrlParameter(content, _api_key); } string url = GoedleConstants.TRACK_URL; Console.WriteLine(event_name); Console.WriteLine(event_id); goedleUploadHandler.add(content); _gio_http_client.sendPost(url, authentication, _gwr, goedleUploadHandler, _staging); // Sending tp Google Analytics for now we only support the Event tracking string type = "event"; if (ga_active) { trackGoogleAnalytics(event_name, event_id, event_value, type); } } }
public void CreateEventAtom() { GoedleAtom rt = new GoedleAtom(this.app_key, this.user_id, this.ts, this.event_name, this.event_id, this.event_value, this.timezone, this.app_version, this.anonymous_id, this.trait_key, this.trait_value, this.ga_active); Dictionary <string, object> goedleAtom = rt.getGoedleAtomDictionary(); CollectionAssert.AreEquivalent(goedleAtom, this.goedleAtomExpected); }
public void track(string event_name, string event_id, string event_value, bool launch, string trait_key, string trait_value) { GoedleHttpClient outer = new GoedleHttpClient(); bool ga_active = !String.IsNullOrEmpty(this.ga_tracking_id); string[] pass = null; int ts = getTimeStamp(); // -1 because c# returns -1 for UTC +1 , * 1000 from Seconds to Milliseconds int timezone = (int)(((DateTime.UtcNow - DateTime.Now).TotalSeconds) * -1 * 1000); GoedleAtom rt = new GoedleAtom(this.app_key, this.user_id, ts, event_name, event_id, event_value, timezone, app_version, this.anonymous_id, trait_key, trait_value, ga_active); if (rt == null) { Console.Write("Data Object is None, there must be an error in the SDK!"); } else { pass = encodeToUrlParameter(rt.getGoedleAtomDictionary()); } outer.send(pass); // Sending tp Google Analytics for now we only support the Event tracking string type = "event"; if (ga_active) { trackGoogleAnalytics(event_name, event_id, event_value, type); } }
public void CreateEventWithIdAtom() { event_id = "test_event_id"; GoedleAtom rt = new GoedleAtom(this.app_key, this.user_id, this.ts, this.event_name, event_id, this.event_value, this.timezone, this.app_version, this.anonymous_id, this.trait_key, this.trait_value, this.ga_active); JSONNode goedleAtom = rt.getGoedleAtomDictionary(); Assert.AreEqual(goedleAtom["event_id"].Value, event_id); //CollectionAssert.AreEquivalent(goedleAtom, this.goedleAtomExpected); }
public void CreateEventIdentifyNoGAAtom() { anonymous_id = "123e4567-e89b-12d3-a456-426655440000"; event_name = "identify"; GoedleAtom rt = new GoedleAtom(this.app_key, this.user_id, this.ts, event_name, this.event_id, this.event_value, this.timezone, this.app_version, anonymous_id, this.trait_key, this.trait_value, this.ga_active); JSONNode goedleAtom = rt.getGoedleAtomDictionary(); //CollectionAssert.AreEquivalent(goedleAtom, this.goedleAtomExpected); Assert.AreEqual(goedleAtom["event"].Value, event_name); Assert.AreEqual(goedleAtom["anonymous_id"].Value, anonymous_id); }
public void CreateEventWithIdAndValueAtom() { this.goedleAtomExpected.Add("event_id", "test_event_id"); this.goedleAtomExpected.Add("event_value", "test_event_value"); this.event_id = "test_event_id"; this.event_value = "test_event_value"; GoedleAtom rt = new GoedleAtom(this.app_key, this.user_id, this.ts, this.event_name, this.event_id, this.event_value, this.timezone, this.app_version, this.anonymous_id, this.trait_key, this.trait_value, this.ga_active); Dictionary <string, object> goedleAtom = rt.getGoedleAtomDictionary(); CollectionAssert.AreEquivalent(goedleAtom, this.goedleAtomExpected); }
public void CreateEventIdentifyNoGAAtom() { this.goedleAtomExpected["event"] = "identify"; this.goedleAtomExpected["anonymous_id"] = "123e4567-e89b-12d3-a456-426655440000"; this.anonymous_id = "123e4567-e89b-12d3-a456-426655440000"; this.event_name = "identify"; GoedleAtom rt = new GoedleAtom(this.app_key, this.user_id, this.ts, this.event_name, this.event_id, this.event_value, this.timezone, this.app_version, this.anonymous_id, this.trait_key, this.trait_value, this.ga_active); Dictionary <string, object> goedleAtom = rt.getGoedleAtomDictionary(); CollectionAssert.AreEquivalent(goedleAtom, this.goedleAtomExpected); }
public void CreateEventAtom() { GoedleAtom rt = new GoedleAtom(this.app_key, this.user_id, this.ts, this.event_name, this.event_id, this.event_value, this.timezone, this.app_version, this.anonymous_id, this.trait_key, this.trait_value, this.ga_active); JSONNode goedleAtom = rt.getGoedleAtomDictionary(); Assert.AreEqual(goedleAtom["app_key"].Value, this.app_key); Assert.AreEqual(goedleAtom["user_id"].Value, this.user_id); Assert.AreEqual(goedleAtom["app_version"].Value, this.app_version); Assert.AreEqual(goedleAtom["event"].Value, this.event_name); Assert.AreEqual(goedleAtom["timezone"].AsInt, this.timezone); Assert.AreEqual(goedleAtom["build_nr"].Value, GoedleConstants.BUILD_NR); }
public void CreateIdentifyTraitsAtom() { event_name = "identify"; trait_key = "first_name"; trait_value = "Marc"; GoedleAtom rt = new GoedleAtom(this.app_key, this.user_id, this.ts, this.event_name, this.event_id, this.event_value, this.timezone, this.app_version, this.anonymous_id, this.trait_key, this.trait_value, this.ga_active); JSONNode goedleAtom = rt.getGoedleAtomDictionary(); //CollectionAssert.AreEquivalent(goedleAtom, this.goedleAtomExpected); Assert.AreEqual(goedleAtom["event"].Value, event_name); Assert.AreEqual(goedleAtom["first_name"].Value, trait_value); }
public void CreateIdentifyTraitsAtom() { this.event_name = "identify"; this.trait_key = "first_name"; this.trait_value = "Marc"; this.goedleAtomExpected["event"] = "identify"; this.goedleAtomExpected.Add(trait_key, trait_value); GoedleAtom rt = new GoedleAtom(this.app_key, this.user_id, this.ts, this.event_name, this.event_id, this.event_value, this.timezone, this.app_version, this.anonymous_id, this.trait_key, this.trait_value, this.ga_active); Dictionary <string, object> goedleAtom = rt.getGoedleAtomDictionary(); CollectionAssert.AreEquivalent(goedleAtom, this.goedleAtomExpected); }