Esempio n. 1
0
        public GoogleAnalyticsService(Context c, IPackageInfo packageInfo, IAppSettings settings, ILogger logger)
        {
            Trackers = new List <Tracker>();

            try
            {
                GAServiceManager.Instance.SetDispatchPeriod(20);

                var instance = GoogleAnalytics.GetInstance(c);

                // Prevent testing/debugging data from being sent to GA
                #if DEBUG
                instance.SetDebug(true);
                #endif

                // MK's tracking id
                Trackers.Add(instance.GetTracker("UA-44714416-1"));

                if (settings.Data.GoogleAnalyticsTrackingId.HasValue())
                {
                    // Company's own tracking id
                    var tracker = instance.GetTracker(settings.Data.GoogleAnalyticsTrackingId);

                    // TODO MKTAXI-3716 Verify if this solution is viable, since it's by company and it should not be called everytime the app starts
                    // A campaign can be set manually:
                    //var uriPath = "http://www.taxihail.com/?utm_source=email&utm_medium=cool_installations&utm_campaign=installations&utm_content=blih";
                    //tracker.SetCampaign(uriPath);
                    Trackers.Add(tracker);
                }

                var appName = settings.Data.TaxiHail.ApplicationName.Replace(' ', '_');
                var version = packageInfo.Version;
                Trackers.ForEach(x => {
                    x.SetAppName(appName);
                    x.SetAppVersion(version);
                });
            }
            catch (Exception ex)
            {
                logger.LogError(ex);
            }
        }
 public PushNotificationService(IServerSettings serverSettings, ILogger logger)
 {
     _serverSettings = serverSettings;
     _logger         = logger;
 }
        public GoogleAnalyticsService(Context c, IPackageInfo packageInfo, IAppSettings settings, ILogger logger)
        {
            Trackers = new List <Tracker>();

            try
            {
                var instance = GoogleAnalytics.GetInstance(c);
                instance.SetLocalDispatchPeriod(20);

                // Prevent testing/debugging data from being sent to GA
                #if DEBUG
                instance.SetDryRun(true);
                #endif

                // MK's tracking id
                Trackers.Add(instance.NewTracker("UA-44714416-1"));

                if (settings.Data.GoogleAnalyticsTrackingId.HasValue())
                {
                    // Company's own tracking id
                    Trackers.Add(instance.NewTracker(settings.Data.GoogleAnalyticsTrackingId));
                }

                var appName = settings.Data.TaxiHail.ApplicationName.Replace(' ', '_');
                var version = packageInfo.Version;
                Trackers.ForEach(x => {
                    x.SetAppName(appName);
                    x.SetAppVersion(version);
                });
            }
            catch (Exception ex)
            {
                logger.LogError(ex);
            }
        }