Added google analytics. (only enabled in production)

This commit is contained in:
kay.one 2011-10-27 22:13:56 -07:00
parent eb84583f68
commit 5b3f0bdffe
4 changed files with 40 additions and 14 deletions

View File

@ -97,7 +97,7 @@
<Naming2>
<EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
<EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="PrivateStaticReadonly" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />
<PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />
<PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />

View File

@ -7,23 +7,20 @@ namespace NzbDrone.Common
{
public class EnviromentProvider
{
public virtual String LogPath
{
get { return Environment.CurrentDirectory; }
}
public virtual bool IsUserInteractive
{
get { return Environment.UserInteractive; }
}
#if DEBUG
private static readonly bool isInDebug = true;
#else
private static readonly bool isInDebug = false;
#endif
private static readonly string processName = Process.GetCurrentProcess().ProcessName.ToLower();
public static bool IsProduction
{
get
{
if (Debugger.IsAttached) return false;
var processName = Process.GetCurrentProcess().ProcessName.ToLower();
if (isInDebug || Debugger.IsAttached) return false;
Console.WriteLine(processName);
if (processName.Contains("nunit")) return false;
@ -34,6 +31,16 @@ namespace NzbDrone.Common
}
}
public virtual String LogPath
{
get { return Environment.CurrentDirectory; }
}
public virtual bool IsUserInteractive
{
get { return Environment.UserInteractive; }
}
public virtual string ApplicationPath
{
get

View File

@ -733,6 +733,10 @@
<Folder Include="App_Data\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Common\NzbDrone.Common.csproj">
<Project>{F2BE0FDF-6E47-4827-A420-DD4EF82407F8}</Project>
<Name>NzbDrone.Common</Name>
</ProjectReference>
<ProjectReference Include="..\NzbDrone.Core\NzbDrone.Core.csproj">
<Project>{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}</Project>
<Name>NzbDrone.Core</Name>

View File

@ -1,5 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@using Helpers;
@using NzbDrone.Common
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link rel="SHORTCUT ICON" href="../../favicon.ico" />
@ -16,7 +17,6 @@
<link type="text/css" rel="stylesheet" href="/Content/overrides.css" />
<link type="text/css" rel="stylesheet" href="/Content/Menu.css" />
<link type="text/css" rel="stylesheet" href="/Content/Slider.css" />
<script type="text/javascript" src="/Scripts/Plugins/jquery-1.6.3.min.js"></script>
<script type="text/javascript" src="/Scripts/Plugins/jquery-ui-1.8.16.min.js"></script>
<script type="text/javascript" src="/Scripts/Plugins/MicrosoftAjax.js"></script>
@ -30,7 +30,6 @@
<script type="text/javascript" src="/Scripts/autocomplete.js"></script>
<script type="text/javascript" src="/Scripts/addSeries.js"></script>
<script type="text/javascript" src="/Scripts/slider.js"></script>
@MvcMiniProfiler.MiniProfiler.RenderIncludes()
@RenderSection("HeaderContent", required: false)
</head>
@ -72,5 +71,21 @@
@(Html.Telerik().ScriptRegistrar().jQuery(false))
@RenderSection("Scripts", required: false)
<script type="text/javascript" src="/Scripts/Notification.js"></script>
@if (EnviromentProvider.IsProduction)
{
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-8318723-7']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(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>
}
</body>
</html>