public GoogleAnalyticsService(GoogleAnalyticsSettings googleAnalyticsSettings,
                               ITranslationService translationService, ILogger logger)
 {
     _googleAnalyticsSettings = googleAnalyticsSettings;
     _translationService      = translationService;
     _logger = logger;
 }
 public HomeController(
     ILocalizationService localizationService,
     IStoreContext storeContext,
     CommonSettings commonSettings,
     GoogleAnalyticsSettings googleAnalyticsSettings,
     ISettingService settingService,
     IWorkContext workContext,
     ICacheManager cacheManager,
     IOrderReportService orderReportService,
     ICustomerService customerService,
     IRepository <Product> productRepository,
     IRepository <ReturnRequest> returnRequestRepository)
 {
     this._localizationService     = localizationService;
     this._storeContext            = storeContext;
     this._commonSettings          = commonSettings;
     this._googleAnalyticsSettings = googleAnalyticsSettings;
     this._settingService          = settingService;
     this._workContext             = workContext;
     this._cacheManager            = cacheManager;
     this._orderReportService      = orderReportService;
     this._customerService         = customerService;
     this._productRepository       = productRepository;
     this._returnRequestRepository = returnRequestRepository;
 }
	public override void OnInspectorGUI() {
		settings = target as GoogleAnalyticsSettings;

		GUI.changed = false;

		if(settings.IsDisabled) {
			GUI.enabled = false;
		} else {
			GUI.enabled = true;
		}


		Accounts();
		EditorGUILayout.Space();
		GeneralOptions();
		EditorGUILayout.Space();
		AdvancedTracking();
		EditorGUILayout.Space();
		AutoTracking();
		EditorGUILayout.Space();
		AboutGUI();

		ButtonsGUI();

		if(GUI.changed) {
			DirtyEditor();
		}
	}
        private static string Hostname(GoogleAnalyticsSettings account)
        {
            try
            {
                if (account.AllowLinker)
                {
                    string[] host = account.WebsiteUrl.Split(new char[] { '.' });

                    int length = host.Length;

                    if (length >= 2)
                    {
                        return(host[length - 2] + "." + host[length - 1]);
                    }
                    else
                    {
                        return("none");
                    }
                }
                else
                {
                    return("none");
                }
            }
            catch (Exception ex)
            {
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
                return("none");
            }
        }
Esempio n. 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            HccApp.CurrentStore.Settings.Analytics.UseGoogleAdWords     = chkGoogleAdwords.Checked;
            HccApp.CurrentStore.Settings.Analytics.GoogleAdWordsId      = GoogleAdwordsConversionIdField.Text;
            HccApp.CurrentStore.Settings.Analytics.GoogleAdWordsFormat  = ddlAdwordsFormat.SelectedValue;
            HccApp.CurrentStore.Settings.Analytics.GoogleAdWordsLabel   = GoogleAdwordsLabelField.Text;
            HccApp.CurrentStore.Settings.Analytics.GoogleAdWordsBgColor = GoogleAdwordsBackgroundColorField.Text;

            HccApp.CurrentStore.Settings.Analytics.UseGoogleEcommerce       = chkGoogleEcommerce.Checked;
            HccApp.CurrentStore.Settings.Analytics.GoogleEcommerceCategory  = GoogleEcommerceCategoryNameField.Text;
            HccApp.CurrentStore.Settings.Analytics.GoogleEcommerceStoreName = GoogleEcommerceStoreNameField.Text;

            var googleSettings = new GoogleAnalyticsSettings();

            googleSettings.UseTracker = chkGoogleTracker.Checked;
            googleSettings.TrackerId  = GoogleTrackingIdField.Text;
            HccApp.AccountServices.SetGoogleAnalyticsSettings(googleSettings);

            HccApp.CurrentStore.Settings.Analytics.UseYahooTracker = chkYahoo.Checked;
            HccApp.CurrentStore.Settings.Analytics.YahooAccountId  = YahooAccountIdField.Text;

            HccApp.CurrentStore.Settings.Analytics.AdditionalMetaTags = AdditionalMetaTagsField.Text;
            HccApp.CurrentStore.Settings.Analytics.BottomAnalytics    = BottomAnalyticsField.Text;

            HccApp.CurrentStore.Settings.Analytics.UseShopZillaSurvey = chkUseShopZillaSurvey.Checked;
            HccApp.CurrentStore.Settings.Analytics.ShopZillaId        = ShopZillaIdField.Text.Trim();

            HccApp.UpdateCurrentStore();

            ucMessageBox.ShowOk(Localization.GetString("SettingsSuccessful"));
        }
 public GoogleAnalyticsService(GoogleAnalyticsSettings googleAnalyticsSettings,
                               ILocalizationService localizationService, ILogger logger)
 {
     _googleAnalyticsSettings = googleAnalyticsSettings;
     _localizationService     = localizationService;
     _logger = logger;
 }
Esempio n. 7
0
        public override GoogleAnalyticsSettings GetGoogleAnalyticsSettings()
        {
            var config = AnalyticsConfiguration.GetConfig("GoogleAnalytics");
            var result = new GoogleAnalyticsSettings();

            if (config != null)
            {
                bool?enable = null;
                foreach (AnalyticsSetting setting in config.Settings)
                {
                    switch (setting.SettingName.ToLower())
                    {
                    case "enable":
                        result.UseTracker = bool.Parse(setting.SettingValue);
                        break;

                    case "trackingid":
                        result.TrackerId = setting.SettingValue;
                        break;
                    }
                }
                if (!enable.HasValue)
                {
                    enable = !string.IsNullOrEmpty(result.TrackerId);
                }
                if (enable.HasValue)
                {
                    result.UseTracker = enable.Value;
                }
            }
            return(result);
        }
 public WidgetsGoogleAnalyticsViewComponent(CurrencySettings currencySettings,
                                            GoogleAnalyticsSettings googleAnalyticsSettings,
                                            ICategoryService categoryService,
                                            ICurrencyService currencyService,
                                            ICustomerService customerService,
                                            IGenericAttributeService genericAttributeService,
                                            ILogger logger,
                                            IOrderService orderService,
                                            IProductService productService,
                                            ISettingService settingService,
                                            IStoreContext storeContext,
                                            IWorkContext workContext)
 {
     _currencySettings        = currencySettings;
     _googleAnalyticsSettings = googleAnalyticsSettings;
     _categoryService         = categoryService;
     _currencyService         = currencyService;
     _customerService         = customerService;
     _genericAttributeService = genericAttributeService;
     _logger         = logger;
     _orderService   = orderService;
     _productService = productService;
     _settingService = settingService;
     _storeContext   = storeContext;
     _workContext    = workContext;
 }
Esempio n. 9
0
 public WidgetsGoogleAnalyticsController(IWorkContext workContext, ISettingService settingService,
                                         IOrderService orderService, ILogger logger,
                                         ICategoryService categoryService,
                                         GoogleAnalyticsSettings trackingScriptsSettings, StoreInformationSettings storeInformationSettings)
 {
     this._workContext              = workContext;
     this._settingService           = settingService;
     this._orderService             = orderService;
     this._logger                   = logger;
     this._categoryService          = categoryService;
     this._googleAnalyticsSettings  = trackingScriptsSettings;
     this._storeInformationSettings = storeInformationSettings;
 }
 public WidgetsGoogleAnalyticsController(IWorkContext workContext, ISettingService settingService,
     IOrderService orderService, ILogger logger,
     ICategoryService categoryService,
     GoogleAnalyticsSettings trackingScriptsSettings, StoreInformationSettings storeInformationSettings)
 {
     this._workContext = workContext;
     this._settingService = settingService;
     this._orderService = orderService;
     this._logger = logger;
     this._categoryService = categoryService;
     this._googleAnalyticsSettings = trackingScriptsSettings;
     this._storeInformationSettings = storeInformationSettings;
 }
Esempio n. 11
0
 public WidgetsGoogleAnalyticsViewComponent(GoogleAnalyticsSettings googleAnalyticsSettings,
                                            IWorkContext workContext,
                                            IStoreContext storeContext,
                                            ISettingService settingService,
                                            IOrderService orderService,
                                            ILogger logger)
 {
     this._googleAnalyticsSettings = googleAnalyticsSettings;
     this._workContext             = workContext;
     this._storeContext            = storeContext;
     this._settingService          = settingService;
     this._orderService            = orderService;
     this._logger = logger;
 }
Esempio n. 12
0
 public HomeController(
     ILocalizationService localizationService,
     GoogleAnalyticsSettings googleAnalyticsSettings,
     IWorkContext workContext,
     IOrderReportService orderReportService,
     ICustomerService customerService,
     IMediator mediator)
 {
     _localizationService     = localizationService;
     _googleAnalyticsSettings = googleAnalyticsSettings;
     _workContext             = workContext;
     _orderReportService      = orderReportService;
     _customerService         = customerService;
     _mediator = mediator;
 }
Esempio n. 13
0
        public ActionResult Configure(GoogleAnalyticsSettings settings)
        {
            var model = new ConfigurationModel();

            MiniMapper.Map(settings, model);

            model.ZoneId = settings.WidgetZone;
            model.AvailableZones.Add(new SelectListItem {
                Text = "<head> HTML tag", Value = "head_html_tag"
            });
            model.AvailableZones.Add(new SelectListItem {
                Text = "Before <body> end HTML tag", Value = "body_end_html_tag_before"
            });

            return(View(model));
        }
Esempio n. 14
0
        public override void SetGoogleAnalyticsSettings(GoogleAnalyticsSettings newSettings)
        {
            var config = AnalyticsConfiguration.GetConfig("GoogleAnalytics");

            if (config == null)
            {
                var isCommunityEdition = DotNetNukeContext.Current.Application.Name == "DNNCORP.CE";

                config = new AnalyticsConfiguration();
                if (!isCommunityEdition)
                {
                    config.Rules = new AnalyticsRuleCollection();
                }
                config.Settings = new AnalyticsSettingCollection();

                if (!isCommunityEdition)
                {
                    var enable = new AnalyticsSetting();
                    enable.SettingName = "Enable";
                    config.Settings.Add(enable);
                }

                var trackingId = new AnalyticsSetting();
                trackingId.SettingName = "TrackingId";
                config.Settings.Add(trackingId);
            }

            foreach (AnalyticsSetting setting in config.Settings)
            {
                switch (setting.SettingName.ToLower())
                {
                case "enable":
                    setting.SettingValue = newSettings.UseTracker.ToString();
                    break;

                case "trackingid":
                    setting.SettingValue = newSettings.TrackerId;
                    break;
                }
            }
            AnalyticsConfiguration.SaveConfig("GoogleAnalytics", config);
        }
Esempio n. 15
0
 public HomeController(
     ITranslationService translationService,
     GoogleAnalyticsSettings googleAnalyticsSettings,
     IWorkContext workContext,
     IGroupService groupService,
     IOrderReportService orderReportService,
     IProductsReportService productsReportService,
     ILogger logger,
     IGrandAuthenticationService authenticationService,
     IMediator mediator)
 {
     _translationService      = translationService;
     _googleAnalyticsSettings = googleAnalyticsSettings;
     _workContext             = workContext;
     _groupService            = groupService;
     _orderReportService      = orderReportService;
     _productsReportService   = productsReportService;
     _logger = logger;
     _authenticationService = authenticationService;
     _mediator = mediator;
 }
Esempio n. 16
0
        /// <summary>
        /// Install plugin
        /// </summary>
        public override void Install()
        {
            var settings = new GoogleAnalyticsSettings
            {
                GoogleId              = "UA-0000000-0",
                TrackingScript        = @"<!-- BEGIN Google Analytics -->
<script type=""text/javascript"">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{GOOGLEID}']);
_gaq.push(['_trackPageview']);
{ECOMMERCE}
(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- END Google Analytics -->
",
                EcommerceScript       = @"_gaq.push(['_addTrans', '{ORDERID}', '{SITE}', '{TOTAL}', '{TAX}', '{SHIP}', '{CITY}', '{STATEPROVINCE}', '{COUNTRY}']);
{DETAILS} 
_gaq.push(['_trackTrans']); ",
                EcommerceDetailScript = @"_gaq.push(['_addItem', '{ORDERID}', '{PRODUCTSKU}', '{PRODUCTNAME}', '{CATEGORYNAME}', '{UNITPRICE}', '{QUANTITY}' ]); ",
            };

            _settingService.SaveSetting(settings);

            //this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId", "ID");
            //this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID.");
            //this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript", "Tracking code with {ECOMMERCE} line");
            //this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint", "Paste the tracking code generated by Google Analytics here. {GOOGLEID} and {ECOMMERCE} will be dynamically replaced.");
            //this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceScript", "Tracking code for {ECOMMERCE} part, with {DETAILS} line");
            //this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceScript.Hint", "Paste the tracking code generated by Google analytics here. {ORDERID}, {SITE}, {TOTAL}, {TAX}, {SHIP}, {CITY}, {STATEPROVINCE}, {COUNTRY}, {DETAILS} will be dynamically replaced.");
            //this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceDetailScript", "Tracking code for {DETAILS} part");
            //this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceDetailScript.Hint", "Paste the tracking code generated by Google analytics here. {ORDERID}, {PRODUCTSKU}, {PRODUCTNAME}, {CATEGORYNAME}, {UNITPRICE}, {QUANTITY} will be dynamically replaced.");
            //this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludingTax", "Include tax");
            //this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludingTax.Hint", "Check to include tax when generating tracking code for {ECOMMERCE} part.");

            base.Install();
        }
 public WidgetsGoogleAnalyticsViewComponent(CurrencySettings currencySettings,
                                            GoogleAnalyticsSettings googleAnalyticsSettings,
                                            ICategoryService categoryService,
                                            ICurrencyService currencyService,
                                            IGenericAttributeService genericAttributeService,
                                            ILogger logger,
                                            IOrderService orderService,
                                            IProductAttributeParser productAttributeParser,
                                            ISettingService settingService,
                                            IStoreContext storeContext,
                                            IWorkContext workContext)
 {
     this._currencySettings        = currencySettings;
     this._googleAnalyticsSettings = googleAnalyticsSettings;
     this._categoryService         = categoryService;
     this._currencyService         = currencyService;
     this._genericAttributeService = genericAttributeService;
     this._logger                 = logger;
     this._orderService           = orderService;
     this._productAttributeParser = productAttributeParser;
     this._settingService         = settingService;
     this._storeContext           = storeContext;
     this._workContext            = workContext;
 }
Esempio n. 18
0
    public override void OnInspectorGUI()
    {
        settings = target as GoogleAnalyticsSettings;

        GUI.changed = false;

        if (settings.IsDisabled)
        {
            GUI.enabled = false;
        }
        else
        {
            GUI.enabled = true;
        }



        Messages();
        EditorGUILayout.Space();
        Accounts();
        EditorGUILayout.Space();
        GeneralOptions();
        EditorGUILayout.Space();
        AdvancedTracking();
        EditorGUILayout.Space();
        AutoTracking();
        EditorGUILayout.Space();
        AboutGUI();

        ButtonsGUI();

        if (GUI.changed)
        {
            DirtyEditor();
        }
    }
Esempio n. 19
0
 public WidgetsGoogleAnalyticsController(ISettingService settingService,
                                         GoogleAnalyticsSettings googleAnalyticsSettings)
 {
     this._settingService          = settingService;
     this._googleAnalyticsSettings = googleAnalyticsSettings;
 }
 public ActionResult Configure(GoogleAnalyticsSettings settings)
 {
     return(View());
 }
Esempio n. 21
0
        /// <summary>
        /// Install plugin
        /// </summary>
        public override void Install()
        {
            var settings = new GoogleAnalyticsSettings()
            {
                GoogleId = "UA-0000000-0",
                //TrackingScript = "<script type=\"text/javascript\"> var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\"); document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\")); </script> <script type=\"text/javascript\"> try { var pageTracker = _gat._getTracker(\"UA-0000000-0\"); pageTracker._trackPageview(); } catch(err) {}</script>",
                TrackingScript = @"<!-- Google code for Analytics tracking -->
            <script type=""text/javascript"">
            var _gaq = _gaq || [];
            _gaq.push(['_setAccount', '{GOOGLEID}']);
            _gaq.push(['_trackPageview']);
            {ECOMMERCE}
            (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
            })();
            </script>",
                EcommerceScript = @"_gaq.push(['_addTrans', '{ORDERID}', '{SITE}', '{TOTAL}', '{TAX}', '{SHIP}', '{CITY}', '{STATEPROVINCE}', '{COUNTRY}']);
            {DETAILS}
            _gaq.push(['_trackTrans']); ",
                EcommerceDetailScript = @"_gaq.push(['_addItem', '{ORDERID}', '{PRODUCTSKU}', '{PRODUCTNAME}', '{CATEGORYNAME}', '{UNITPRICE}', '{QUANTITY}' ]); ",

            };
            _settingService.SaveSetting(settings);

            this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId", "ID");
            this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript", "Tracking code with {ECOMMERCE} line");
            this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint", "Paste the tracking code generated by Google Analytics here. {GOOGLEID} and {ECOMMERCE} will be dynamically replaced.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceScript", "Tracking code for {ECOMMERCE} part, with {DETAILS} line");
            this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceScript.Hint", "Paste the tracking code generated by Google analytics here. {ORDERID}, {SITE}, {TOTAL}, {TAX}, {SHIP}, {CITY}, {STATEPROVINCE}, {COUNTRY}, {DETAILS} will be dynamically replaced.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceDetailScript", "Tracking code for {DETAILS} part");
            this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceDetailScript.Hint", "Paste the tracking code generated by Google analytics here. {ORDERID}, {PRODUCTSKU}, {PRODUCTNAME}, {CATEGORYNAME}, {UNITPRICE}, {QUANTITY} will be dynamically replaced.");

            base.Install();
        }
 public WidgetsGoogleAnalyticsController(ISettingService settingService,
     GoogleAnalyticsSettings googleAnalyticsSettings)
 {
     this._settingService = settingService;
     this._googleAnalyticsSettings = googleAnalyticsSettings;
 }
        private void ReloadAnalytics()
        {
            List <GoogleAnalyticsSettings> settings = new List <GoogleAnalyticsSettings>();

            FeedQuery  jsonFeed = new FeedQuery(AccountQuery.HttpsFeedUrl);
            RootObject Accounts = google.Analytics.JSON(jsonFeed);

            foreach (Item account in Accounts.items)
            {
                if (account.childLink != null)
                {
                    jsonFeed = new FeedQuery(account.childLink.href);
                    RootObject WebProperties = google.Analytics.JSON(jsonFeed);

                    foreach (Item webProperty in WebProperties.items)
                    {
                        if (webProperty.childLink != null)
                        {
                            jsonFeed = new FeedQuery(webProperty.childLink.href);
                            RootObject Profiles = google.Analytics.JSON(jsonFeed);

                            if (Profiles.items != null)
                            {
                                foreach (Item profile in Profiles.items)
                                {
                                    GoogleAnalyticsSettings setting = new GoogleAnalyticsSettings();
                                    setting.AccountId         = profile.accountId;
                                    setting.Created           = profile.created;
                                    setting.Currency          = profile.currency;
                                    setting.DefaultPage       = profile.defaultPage;
                                    setting.ECommerceTracking = profile.eCommerceTracking;
                                    setting.Id = profile.id;
                                    setting.InternalWebPropertyId = profile.internalWebPropertyId;
                                    setting.Name          = profile.name;
                                    setting.Timezone      = profile.timezone;
                                    setting.WebPropertyId = profile.webPropertyId;
                                    setting.WebsiteUrl    = profile.websiteUrl;

                                    /*
                                     * profile.profileId
                                     * setting.ProfileId = profile.ProfileId;
                                     * setting.WebPropertyId = profile.WebPropertyId;
                                     * setting.ProfileName = profile.ProfileName;
                                     * setting.TableId = profile.TableId;
                                     */
                                    if (SPContext.Current.Site.HostName == profile.websiteUrl)
                                    {
                                        setting.Active = true;
                                    }

                                    settings.Add(setting);

                                    /*
                                     * if (profile.childLink != null)
                                     * {
                                     *  jsonFeed = new FeedQuery(profile.childLink.href);
                                     *  RootObject SubSubItemroot = google.Analytics.JSON(jsonFeed);
                                     * }
                                     */
                                }
                            }
                        }
                    }
                }
            }

            /*
             * AccountQuery query = new AccountQuery();
             *
             * AccountFeed accountFeed = google.Analytics.Query(query);
             *
             * //google.Settings.Analytics = new GoogleAnalyticsSettings[accountFeed.Entries.Count];
             *
             * List<GoogleAnalyticsSettings> settings = new List<GoogleAnalyticsSettings>();
             *
             * foreach (AccountEntry accountEntry in accountFeed.Entries)
             * {
             *  try
             *  {
             *      foreach (WebPropertiesQuery webpropertiesQuery in accountEntry.WebProperties)
             *      {
             *          WebPropertiesFeed webpropertiesFeed = google.Analytics.Query(webpropertiesQuery);
             *
             *          foreach (WebPropertyEntry webpropertyEntry in webpropertiesFeed.Entries)
             *          {
             *              foreach (ProfilesQuery profile in webpropertyEntry.Profiles)
             *              {
             *                  ProfilesFeed profilesFeed = google.Analytics.Query(profile);
             *
             *                  foreach (ProfilesEntry entry in profilesFeed.Entries)
             *                  {
             *
             *                      GoogleAnalyticsSettings setting = new GoogleAnalyticsSettings();
             *
             *                      setting.AccountId = entry.AccountId;
             *                      setting.ProfileId = entry.ProfileId;
             *                      setting.WebPropertyId = entry.WebPropertyId;
             *                      setting.ProfileName = entry.ProfileName;
             *                      setting.TableId = entry.TableId;
             *                      settings.Add(setting);
             *                  }
             *              }
             *
             *          }
             *      }
             *  }
             *  catch (Exception ex)
             *  {
             *      //lbl_error.Text = "Account" + ex.ToString();
             *  }
             * }
             */
            google.Settings.Analytics = settings.ToArray <GoogleAnalyticsSettings>();
            google.Settings.Save();

            /*
             * GoogleAnalyticsSettings settings = new GoogleAnalyticsSettings();
             *
             * settings.HostName = entry.Title.Text;
             * settings.ProfileId = entry.ProfileId.Value;
             * settings.TableId = entry.ProfileId.Value;
             *
             * foreach (Property prop in entry.Properties)
             * {
             *  if (prop.Name == "ga:webPropertyId")
             *  {
             *      settings.AccountId = prop.Value.ToString();
             *      settings.WebPropertyId = prop.Value.ToString();
             *      break;
             *  }
             * }
             * if (SPContext.Current.Site.HostName == entry.Title.Text)
             * {
             *  settings.Active = true;
             * }
             * google.Settings.Analytics.SetValue(settings, index);
             * index++;
             */

            /*
             * DataQuery accountQuery = new DataQuery(AccountQuery.HttpsFeedUrl);
             * DataFeed accountFeed = google.Analytics.Query(accountQuery);
             *
             * google.Settings.Analytics = new GoogleAnalyticsSettings[accountFeed.Entries.Count];
             * /*
             * foreach (AtomEntry account in accountFeed.Entries)
             * {
             *  string webproperties = account.Links.Where(x => x.HRef.Content.EndsWith("webproperties")).First().HRef.Content;
             * }
             *
             * string webPropsUrl = accountFeed.Entries.First().Links.Where(x => x.HRef.Content.EndsWith("webproperties")).First().HRef.Content;
             *
             * DataFeed webPropFeed = google.Analytics.Query(new DataQuery(webPropsUrl));
             *
             * foreach (AtomEntry entry in webPropFeed.Entries)
             * {
             *  List<AtomLink> profileFeedUrl = entry.Links.Where(x => x.HRef.Content.EndsWith("profiles")).ToList<AtomLink>();
             *  foreach (AtomLink link in profileFeedUrl)
             *  {
             *      DataFeed profileFeed = google.Analytics.Query(new DataQuery(link.HRef.Content));
             *
             *      foreach (AtomEntry profile in profileFeed.Entries)
             *      {
             *          string profileUrl = profile.Links[0].HRef.Content;
             *          string profileId = profileUrl.Split(new char[]{'/'}).Last();//(profileUrl.Split("/").Length - 1)
             *      }
             *  }
             * }
             */

            /*
             *          AccountQuery query = new AccountQuery();
             *
             *          AccountFeed accountFeed = google.Analytics.Query(query);
             */
/*
 *                      StringBuilder builder = new StringBuilder();
 *
 *                      google.Settings.Analytics = new GoogleAnalyticsSettings[accountFeed.Entries.Count];
 *
 *                      int index = 0;
 *                      foreach (AccountEntry entry in accountFeed.Entries)
 *                      {
 *                              try
 *                              {
 *                                      GoogleAnalyticsSettings settings = new GoogleAnalyticsSettings();
 *
 *                                      settings.HostName = entry.Title.Text;
 *                                      settings.ProfileId = entry.ProfileId.Value;
 *                                      settings.TableId = entry.ProfileId.Value;
 *
 *                                      foreach (Property prop in entry.Properties)
 *                                      {
 *                                              if (prop.Name == "ga:webPropertyId")
 *                                              {
 *                                                      settings.AccountId = prop.Value.ToString();
 *                                                      settings.WebPropertyId = prop.Value.ToString();
 *                                                      break;
 *                                              }
 *                                      }
 *                                      if (SPContext.Current.Site.HostName == entry.Title.Text)
 *                                      {
 *                                              settings.Active = true;
 *                                      }
 *                                      google.Settings.Analytics.SetValue(settings, index);
 *                                      index++;
 *                              }
 *                              catch (Exception ex)
 *                              {
 *                                      //lbl_error.Text = "Account" + ex.ToString();
 *                              }
 *                      }
 *
 *                      google.Settings.Save();
 */
        }