Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Merged
merged 1 commit into from

3 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
5 Scripts/Package.ps1
@@ -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
View
8 Website/App_Code/ViewHelpers.cshtml
@@ -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);
+ }
}
View
2  Website/Views/Shared/Layout.cshtml
@@ -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>
View
1  Website/Web.config
@@ -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>
Something went wrong with that request. Please try again.