Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

making the Google Analytics script configurable (fixes #455 and #511)

  • Loading branch information...
commit 723f81440a0cd73f4e15838dd8188f45a4ec68c0 1 parent 0e6a9e8
half-ogre half-ogre authored
5 Scripts/Package.ps1
View
@@ -11,6 +11,7 @@
$validationKey = $env:NUGET_GALLERY_VALIDATION_KEY,
$decryptionKey = $env:NUGET_GALLERY_DECRYPTION_KEY,
$vmSize = $env:NUGET_GALLERY_AZURE_VM_SIZE,
+ $googleAnalyticsPropertyId = $env:NUGET_GALLERY_GOOGLE_ANALYTICS_PROPERTY_ID,
$commitSha,
$commitBranch
)
@@ -32,6 +33,7 @@ require-param -value $sslCertificateThumbprint -paramName "sslCertificateThumbpr
require-param -value $validationKey -paramName "validationKey"
require-param -value $decryptionKey -paramName "decryptionKey"
require-param -value $vmSize -paramName "vmSize"
+require-param -value $googleAnalyticsPropertyId -paramName "googleAnalyticsPropertyId"
#Helper Functions
function set-certificatethumbprint {
@@ -153,6 +155,7 @@ set-machinekey $webConfigPath
#Release Tag stuff
print-message("Setting the release tags")
+set-appsetting -path $webConfigPath -name "Gallery:GoogleAnalyticsPropertyId" -value $googleAnalyticsPropertyId
set-appsetting -path $webConfigPath -name "Gallery:ReleaseName" -value "NuGet 1.6 'Hershey'"
set-appsetting -path $webConfigPath -name "Gallery:ReleaseTime" -value (Get-Date -format "dd/MM/yyyy HH:mm:ss")
set-appsetting -path $webConfigPath -name "Gallery:ReleaseSha" -value $commitSha
@@ -173,4 +176,4 @@ rm $compressionCmdBinPath
print-success("Azure package and configuration dropped to $cspkgFolder.")
write-host ""
-Exit 0
+Exit 0
8 Website/App_Code/ViewHelpers.cshtml
View
@@ -1,5 +1,6 @@
 @* Generator: MvcHelper Namespace: NuGetGallery*@
+@using System.Configuration
@using System.Linq;
@using System.Collections;
@using System.Web.Mvc;
@@ -90,4 +91,11 @@
at @time.
</p>
}
+}
+
+@helper AnalyticsScript() {
+ var propertyId = ConfigurationManager.AppSettings["Gallery:GoogleAnalyticsPropertyId"];
+ if (propertyId != null) {
+ @Analytics.GetGoogleHtml(propertyId);
+ }
}
2  Website/Views/Shared/Layout.cshtml
View
@@ -11,7 +11,7 @@
<script src="@Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")"></script>
<script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")"></script>
@MiniProfiler.RenderIncludes()
- @Analytics.GetGoogleHtml("UA-177588-7")
+ @ViewHelpers.AnalyticsScript()
@RenderSection("TopScripts", required: false)
</head>
<body>
1  Website/Web.config
View
@@ -22,6 +22,7 @@
<add key="Gallery:ReleaseSha" value="" />
<add key="Gallery:ReleaseBranch" value="" />
<add key="Gallery:ReleaseTime" value="" />
+ <add key="Gallery:GoogleAnalyticsPropertyId" value="" />
<add key="Configuration:SiteRoot" value="http://nuget.org/" />
</appSettings>
<connectionStrings>
Please sign in to comment.
Something went wrong with that request. Please try again.