Error in Google Analytics for EPiServer

Kalle A
Member since: 2008
 

I have installed the latest version of Google Analytics for EPiServer on an existing CMS6R2 site. The problem is that some requests accessing the AnalyticsDataRepository triggers a FormatException, stack trace:

[FormatException: Input string was not in a correct format.]
   System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) +542
   System.Double.Parse(String s) +29
   System.Linq.WhereSelectListIterator`2.MoveNext() +245
   System.Linq.Enumerable.Sum(IEnumerable`1 source) +120
   EPiServer.GoogleAnalytics.Internal.Services.AnalyticsDataRepository.GetSummaryData(AnalyticsUser user, AnalyticsWebProperty webProperty, Limit limit) +644
   EPiServer.GoogleAnalytics.Internal.Controllers.EPiGaGadgetController.SummaryView(Guid gadgetId, Nullable`1 startDate, Nullable`1 endDate) +347
   lambda_method(Closure , ControllerBase , Object[] ) +273
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +258
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
   System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +120
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +637
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +307
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +704
   System.Web.Mvc.Controller.ExecuteCore() +162
   EPiServer.GoogleAnalytics.Internal.Controllers.EPiGaGadgetController.Execute(RequestContext requestContext) +67
   EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessController(IController controller) +50
   EPiServer.Shell.Web.Mvc.ModuleMvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +28
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +12550291
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

Does anyone recognize this error or can confirm that the module is working (I know there was some problems with the previous version)?

#65107 Jan 21, 2013 11:41
  • Kalle A
    Member since: 2008
     

    Setting globalization culture to en-US solved the problem.

    #65185 Jan 22, 2013 17:36
  • josef.henryson
    Member since: 2011
     

    And what do I do if I want to run my site in sv-SE for example?

    #66072 Feb 19, 2013 15:02
  • Kalle A
    Member since: 2008
     

    You can add the globalization element to your webroot/Modules/EPiServer.GoogleAnalytics/web.config file.

    #66077 Feb 19, 2013 15:25
  • josef.henryson
    Member since: 2011
     

    Great help! It works! Thank you :-)

    #66079 Feb 19, 2013 15:47
  • Niklas Engberg
    Member since: 2012
     

    I am having issues with this aswell, even though I added the globalization element to my web.config located in /modules/EPiServer.GoogleAnalytics/ under configuration/system.web section.

    Our site has the site-language set to Swedish, so I figured I could set the culture and cultureUi attributes of globalization element to sv-SE and sv to get this to work but no luck.

    The only thing that works is if I change the site-langugage under my settings and display options tab in EPiServer UI to English. This is unfortunately not an option as we have a Swedish customer. 

    Josef: Did you just put your globalization element right under the specified section that I mentioned?

    #66346 Feb 27, 2013 13:59
  • josef.henryson
    Member since: 2011
     

    @Niklas: yes I did and it works for us. We also run Swedish everywhere except for this module. 

    On the other hand, non of our statistics seem correct, i.e. the plugin does not display the same numbers as the GA page does. 

    If anyone has managed to get this plugin to function correctly, please let me know :-)

    #66387 Feb 27, 2013 18:06
  • Niklas Engberg
    Member since: 2012
     

    That's interesting, that it "almost" works :)

    It seems that the langugage settings for the current logged in user in EPiServer overrides the underlying configurations about culture and cultureUi set in the globalization element in web.config files.

    The data that is retrieved from Google Analytics seems to be in english culture, which causes the FormatException to be thrown as the current language for our site is in Swedish, a mismatch there between cultures. I tried to change the language for the Google Analytics account to Swedish but that doesn't work either so I don't know what to do.

    The only solution I can come up with is if EPiServer published the source code of this plugin, then you could just modify the Parse-method to explicit take an IFormatProvider with the specified culture.

    #66420 Feb 28, 2013 11:27
  • josef.henryson
    Member since: 2011
     

    :-) well, what I mean is that before we changed the culture we got an exception. With en-US culture we don't get an exception and we see graphs and numbers although they don't match with reality....

    It seems strange that culture from logged in user should override the module config for you, but not for us. 

    <globalization culture="en-US" uiCulture="en" requestEncoding="utf-8" responseEncoding="utf-8" resourceProviderFactoryType="EPiServer.Resources.XmlResourceProviderFactory, EPiServer" />

    Above is our setting that comes first inside <system.web>

    I noticed there is another web.config in the Views folder. Check that it doesn't have another globalization setting that override yours. 

     

    #66423 Feb 28, 2013 11:55
  • Niklas Engberg
    Member since: 2012
     

    I can't get this to work. Tried to modify the globalization element in both Web.config under modules/EPiServer.GoogleAnalytics and under /Views but it doesn't seem to make any difference.

    #66683 Mar 06, 2013 17:48
  • Erika Pedersen
    Member since: 2010
     

    I get the same problem, a format exception if language for the user is not set o English. I have tried to set

    <globalization culture="en-US" uiCulture="en" requestEncoding="utf-8" responseEncoding="utf-8" resourceProviderFactoryType="EPiServer.Resources.XmlResourceProviderFactory, EPiServer" />
    In boths web.config files under modules/EPiServer.GoogleAnalytics, but the only thing getting the module to run is to change the user language. This is not an option for our customer so if anyone knows how to solve this, please post.

     

    #72987 Jul 03, 2013 13:56
  • Pär Wissmark
    Member since: 2007
     

    I took a copy of the language file from the module, moved the copy to the main language folder in our solution, added a new tag for swedish with all english tags(i did not translate them).

    At first i tried to add the swedish tag in the module folder but it didnt hock up... i suppose its cashed in some way when you install the add on


    Not so nice but it worked for me.

    /P

    #80783 Feb 01, 2014 0:38