Esempio n. 1
0
        public void track(string event_name, string event_id, string event_value, bool launch, string trait_key, string trait_value)
        {
            GoedleHttpClient outer = new GoedleHttpClient();

            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       = null;

            if (launch == true)
            {
                rt = new GoedleAtom(app_key, this.user_id, ts, event_name, event_id, event_value, timezone, GoedleConstants.BUILD_NR);
            }
            else
            {
                rt = new GoedleAtom(app_key, this.user_id, ts, event_name, event_id, event_value, trait_key, trait_value);
            }
            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);
        }
        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);
            }
        }