Added google analytics. (only enabled in production)

pull/4/head
kay.one 13 years ago
parent eb84583f68
commit 5b3f0bdffe

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

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

@ -733,6 +733,10 @@
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
</ItemGroup> </ItemGroup>
<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"> <ProjectReference Include="..\NzbDrone.Core\NzbDrone.Core.csproj">
<Project>{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}</Project> <Project>{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}</Project>
<Name>NzbDrone.Core</Name> <Name>NzbDrone.Core</Name>

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

Loading…
Cancel
Save