Version 2.0

We have rewrite the configuration system to accommodate more fields in an orderly manner, so we like to introduce to how would you add your configs to your web.config or app.config file with the following example.

<AnalyticConfigurationSettings>
  <AnalyticConfiguration account="UA-XXXX-Y" property="sathorn.co.th"/>
</AnalyticConfigurationSettings>

As you can see that is much more cleaner then when we were using AppSettings with limited capabilities of single node. To enable this feature, you will have add ConfigSections at the top of your Configuration node in your web.config file as followed;

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="AnalyticConfigurationSettings">
      <section name="AnalyticConfiguration" type="Analytics.Configuration, Analytics" allowLocation="true" allowDefinition="MachineToApplication"/>
    </sectionGroup>
  </configSections>
  ...
</configuration>


Field configuration by Google Analytics Reference that are support in this configuration pattern are selective for application constant settings.
  • account
  • property
  • name
  • displayfeatures
  • forceSSL
  • anonymizeIp
  • sampleRate
  • siteSpeedSampleRate
  • alwaysSendReferrer
  • allowAnchor
  • cookieDomain
  • cookieName
  • cookieExpires
  • legacyCookieDomain
  • EnhancedLink
  • EnhancedCookieName
  • EnhancedDuration
  • EnhancedLevels

Version 1.0

Universal Analytics configuration is done via web.config for both MVC and WebForm projects. You would need to add the AppSettings your Analytics Account number with the key GoogleAnalyticAccount.

appSettings.png

Specific for ASP.NET WebForm project require your to add the reference namespace and control in system.web before you could call the dll library from within web form or masterpage.

system.web.png

Last edited Apr 17, 2014 at 1:02 AM by wangkanai, version 9