Ejemplo n.º 1
0
        private void _startTrackerWithId(string trackingId)
        {
            this.trackingId = trackingId;
            var trackerConfig = new GoogleAnalytics.EasyTrackerConfig();

            trackerConfig.TrackingId = this.trackingId;
            GoogleAnalytics.EasyTracker.Current.Config = trackerConfig;
            this.tracker = GoogleAnalytics.EasyTracker.GetTracker();
        }
Ejemplo n.º 2
0
 private void InitConfig(XmlReader reader)
 {
     Config = EasyTrackerConfig.Load(reader);
     Config.Validate();
 }
Ejemplo n.º 3
0
        private void InitializeTrackerConfig(string trackingID, int dispatcherTimeInSeconds)
        {
            var currentConfig = EasyTracker.Current.Config;
            if (currentConfig == null)
            {
                currentConfig = new EasyTrackerConfig();
            }

            currentConfig.TrackingId = trackingID;
            currentConfig.DispatchPeriod = new TimeSpan(0, 0, dispatcherTimeInSeconds);
            GAServiceManager.Current.DispatchPeriod = TimeSpan.FromSeconds(dispatcherTimeInSeconds);

            EasyTracker.Current.Config = currentConfig;
        }
Ejemplo n.º 4
0
        private static EasyTrackerConfig LoadConfigXml(XmlReader reader)
        {
            var result = new EasyTrackerConfig();

            reader.ReadStartElement("analytics");
            do
            {
                if (reader.IsStartElement())
                {
                    switch (reader.Name)
                    {
                    case "trackingId":
                        result.TrackingId = reader.ReadElementContentAsString();
                        break;

                    case "appName":
                        result.AppName = reader.ReadElementContentAsString();
                        break;

                    case "appVersion":
                        result.AppVersion = reader.ReadElementContentAsString();
                        break;

                    case "sampleFrequency":
                        result.SampleFrequency = reader.ReadElementContentAsFloat();
                        break;

                    case "dispatchPeriod":
                        var dispatchPeriodInSeconds = reader.ReadElementContentAsInt();
                        result.DispatchPeriod = TimeSpan.FromSeconds(dispatchPeriodInSeconds);
                        break;

                    case "sessionTimeout":
                        var sessionTimeoutInSeconds = reader.ReadElementContentAsInt();
                        result.SessionTimeout = (sessionTimeoutInSeconds >= 0) ? TimeSpan.FromSeconds(sessionTimeoutInSeconds) : (TimeSpan?)null;
                        break;

                    case "debug":
                        result.Debug = reader.ReadElementContentAsBoolean();
                        break;

                    case "autoAppLifetimeTracking":
                        result.AutoAppLifetimeTracking = reader.ReadElementContentAsBoolean();
                        break;

                    case "autoAppLifetimeMonitoring":
                        result.AutoAppLifetimeMonitoring = reader.ReadElementContentAsBoolean();
                        break;

                    case "anonymizeIp":
                        result.AnonymizeIp = reader.ReadElementContentAsBoolean();
                        break;

                    case "reportUncaughtExceptions":
                        result.ReportUncaughtExceptions = reader.ReadElementContentAsBoolean();
                        break;

                    case "useSecure":
                        result.UseSecure = reader.ReadElementContentAsBoolean();
                        break;

                    case "autoTrackNetworkConnectivity":
                        result.AutoTrackNetworkConnectivity = reader.ReadElementContentAsBoolean();
                        break;

                    default:
                        reader.Skip();
                        break;
                    }
                }
                else
                {
                    reader.ReadEndElement();
                    break;
                }
            }while (true);
            return(result);
        }
 private static EasyTrackerConfig LoadConfigXml(XmlReader reader)
 {
     var result = new EasyTrackerConfig();
     reader.ReadStartElement("analytics");
     do
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case "trackingId":
                     result.TrackingId = reader.ReadElementContentAsString();
                     break;
                 case "appName":
                     result.AppName = reader.ReadElementContentAsString();
                     break;
                 case "appVersion":
                     result.AppVersion = reader.ReadElementContentAsString();
                     break;
                 case "sampleFrequency":
                     result.SampleFrequency = reader.ReadElementContentAsFloat();
                     break;
                 case "dispatchPeriod":
                     var dispatchPeriodInSeconds = reader.ReadElementContentAsInt();
                     result.DispatchPeriod = TimeSpan.FromSeconds(dispatchPeriodInSeconds);
                     break;
                 case "sessionTimeout":
                     var sessionTimeoutInSeconds = reader.ReadElementContentAsInt();
                     result.SessionTimeout = (sessionTimeoutInSeconds >= 0) ? TimeSpan.FromSeconds(sessionTimeoutInSeconds) : (TimeSpan?)null;
                     break;
                 case "debug":
                     result.Debug = reader.ReadElementContentAsBoolean();
                     break;
                 case "autoAppLifetimeTracking":
                     result.AutoAppLifetimeTracking = reader.ReadElementContentAsBoolean();
                     break;
                 case "autoAppLifetimeMonitoring":
                     result.AutoAppLifetimeMonitoring = reader.ReadElementContentAsBoolean();
                     break;
                 case "anonymizeIp":
                     result.AnonymizeIp = reader.ReadElementContentAsBoolean();
                     break;
                 case "reportUncaughtExceptions":
                     result.ReportUncaughtExceptions = reader.ReadElementContentAsBoolean();
                     break;
                 case "useSecure":
                     result.UseSecure = reader.ReadElementContentAsBoolean();
                     break;
                 case "autoTrackNetworkConnectivity":
                     result.AutoTrackNetworkConnectivity = reader.ReadElementContentAsBoolean();
                     break;
                 default:
                     reader.Skip();
                     break;
             }
         }
         else
         {
             reader.ReadEndElement();
             break;
         }
     }
     while (true);
     return result;
 }