Exemplo n.º 1
0
        public AnalyticsClient(string domain, string trackingCode)
        {
            Random randomNumber = new Random();

            m_sessionVariables = new CustomVariableBag();
            Timestamp          = ConvertToUnixTimestamp(DateTime.Now).ToString();
            Domain             = domain;
            RandomNumber       = randomNumber.Next(1000000000).ToString();
            TrackingCode       = trackingCode;
            UserAgent          = GetDefaultUserAgent();
        }
Exemplo n.º 2
0
      public AnalyticsClient(string domain, string trackingCode)
      {
         Random randomNumber = new Random();

         m_sessionVariables = new CustomVariableBag();
         Timestamp = ConvertToUnixTimestamp(DateTime.Now).ToString();
         Domain = domain;
         RandomNumber = randomNumber.Next(1000000000).ToString();
         TrackingCode = trackingCode;
         UserAgent = GetDefaultUserAgent();
      }
Exemplo n.º 3
0
        public void SubmitPageView(string page, string title, CustomVariableBag pageVariables)
        {
            var client = BuildBaseWebClient(page, title);

            var variables = m_sessionVariables.MergeWith(pageVariables);

            if (variables.Any())
            {
                client.QueryString["utme"] = variables.ToUtme();
            }

            client.DownloadDataAsync(new Uri("__utm.gif", UriKind.Relative));
        }
Exemplo n.º 4
0
        public CustomVariableBag MergeWith(CustomVariableBag other)
        {
            var variables = new KeyValuePair <string, string>?[5];

            m_variables.CopyTo(variables, 0);

            for (int i = 0; i < 5; i++)
            {
                if (other.m_variables[i] != null)
                {
                    variables[i] = other.m_variables[i];
                }
            }

            return(new CustomVariableBag(variables));
        }
Exemplo n.º 5
0
      public CustomVariableBag MergeWith(CustomVariableBag other)
      {
         var variables = new KeyValuePair<string, string>?[5];

         m_variables.CopyTo(variables, 0);

         for (int i = 0; i < 5; i++)
         {
            if (other.m_variables[i] != null)
            {
               variables[i] = other.m_variables[i];
            }
         }

         return new CustomVariableBag(variables);
      }
Exemplo n.º 6
0
        public void SubmitTiming(string page, string title, string category, string action, int time, string label, CustomVariableBag pageVariables)
        {
            var client = BuildBaseWebClient(page, title);

            client.QueryString["utmt"] = "event";
            client.QueryString["utme"] = FormatTimingUtme(category, action, time, label);

            var variables = m_sessionVariables.MergeWith(pageVariables);

            if (variables.Any())
            {
                client.QueryString["utme"] += variables.ToUtme();
            }

            client.DownloadDataAsync(new Uri("__utm.gif", UriKind.Relative));
        }
Exemplo n.º 7
0
        public void SubmitEvent(string page, string title, string category, string action, string label, string value, CustomVariableBag pageVariables)
        {
            var client = BuildBaseWebClient(page, title);

            client.QueryString["utmt"] = "event";
            client.QueryString["utme"] = FormatUtme(category, action, label, value);

            var variables = m_sessionVariables.MergeWith(pageVariables);

            if (variables.Any())
            {
                client.QueryString["utme"] += variables.ToUtme();
            }

            ThreadPool.QueueUserWorkItem(state => {
                client.DownloadDataAsync(new Uri("__utm.gif", UriKind.Relative));
            });
        }
Exemplo n.º 8
0
      public void SubmitTiming(string page, string title, string category, string action, int time, string label, CustomVariableBag pageVariables)
      {
         var client = BuildBaseWebClient(page, title);

         client.QueryString["utmt"] = "event";
         client.QueryString["utme"] = FormatTimingUtme(category, action, time, label);

         var variables = m_sessionVariables.MergeWith(pageVariables);

         if (variables.Any())
            client.QueryString["utme"] += variables.ToUtme();

         ThreadPool.QueueUserWorkItem(state => {
            client.DownloadDataAsync(new Uri("__utm.gif", UriKind.Relative));
         });
      }
Exemplo n.º 9
0
      public void SubmitPageView(string page, string title, CustomVariableBag pageVariables)
      {
         var client = BuildBaseWebClient(page, title);

         var variables = m_sessionVariables.MergeWith(pageVariables);

         if (variables.Any())
            client.QueryString["utme"] = variables.ToUtme();

         ThreadPool.QueueUserWorkItem(state => {
            client.DownloadDataAsync(new Uri("__utm.gif", UriKind.Relative));
         });
      }