Mercurial > hg > nginx-site
changeset 543:9085f0c59dc6
Google Analytics tracking script added to all pages
author | Sergey Budnevitch <sb@waeme.net> |
---|---|
date | Wed, 20 Jun 2012 13:46:28 +0000 |
parents | a9e6a8613534 |
children | 1507ec5ba69a |
files | GNUmakefile xsls/article.xsls xsls/books.xsls xsls/download.xsls xsls/error.xsls xsls/ga.xsls xsls/news.xsls xsls/security.xsls |
diffstat | 8 files changed, 50 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/GNUmakefile +++ b/GNUmakefile @@ -48,6 +48,7 @@ ARTICLE_DEPS = \ xslt/body.xslt \ xslt/menu.xslt \ xslt/donate.xslt \ + xslt/ga.xslt \ xslt/directive.xslt \ xslt/content.xslt \ xslt/versions.xslt @@ -63,6 +64,7 @@ NEWS_DEPS = \ xslt/style.xslt \ xslt/body.xslt \ xslt/menu.xslt \ + xslt/ga.xslt \ xslt/content.xslt DOWNLOAD_DEPS = \ @@ -76,6 +78,7 @@ DOWNLOAD_DEPS = \ xslt/style.xslt \ xslt/body.xslt \ xslt/menu.xslt \ + xslt/ga.xslt \ xslt/content.xslt SECURITY_DEPS = \ @@ -89,6 +92,7 @@ SECURITY_DEPS = \ xslt/style.xslt \ xslt/body.xslt \ xslt/menu.xslt \ + xslt/ga.xslt \ xslt/content.xslt BOOK_DEPS = \ @@ -102,6 +106,7 @@ BOOK_DEPS = \ xslt/style.xslt \ xslt/body.xslt \ xslt/menu.xslt \ + xslt/ga.xslt \ xslt/content.xslt LANGS = en ja he ru tr @@ -140,6 +145,7 @@ include $(foreach lang, $(LANGS), xml/$ xml/menu.xml \ dtd/article.dtd \ dtd/content.dtd \ + xslt/ga.xslt \ xslt/error.xslt $(call XSLT, xslt/error.xslt, $<, $@)
--- a/xsls/article.xsls +++ b/xsls/article.xsls @@ -22,6 +22,7 @@ X:include href = "menu.xslt"; X:include href = "donate.xslt"; X:include href = "directive.xslt"; X:include href = "content.xslt"; +X:include href = "ga.xslt"; X:include href = "versions.xslt"; @@ -34,6 +35,8 @@ X:template = "/article | /module" { !style (lang="@lang") + !ga () + </head> !body (lang="@lang") @@ -51,6 +54,8 @@ X:template = "/article[@lang='he'] | /mo !style (lang="@lang") + !ga () + </head> !body (lang="@lang")
--- a/xsls/books.xsls +++ b/xsls/books.xsls @@ -18,6 +18,7 @@ X:include href = "link.xslt"; X:include href = "style.xslt"; X:include href = "body.xslt"; X:include href = "menu.xslt"; +X:include href = "ga.xslt"; X:include href = "content.xslt"; @@ -28,6 +29,8 @@ X:template = "/article" { !style (lang="@lang") + !ga () + </head> !body (lang="@lang")
--- a/xsls/download.xsls +++ b/xsls/download.xsls @@ -18,6 +18,7 @@ X:include href = "link.xslt"; X:include href = "style.xslt"; X:include href = "body.xslt"; X:include href = "menu.xslt"; +X:include href = "ga.xslt"; X:include href = "content.xslt"; @@ -28,6 +29,8 @@ X:template = "/article" { !style (lang="@lang") + !ga () + </head> !body (lang="@lang")
--- a/xsls/error.xsls +++ b/xsls/error.xsls @@ -1,5 +1,7 @@ X:stylesheet { +X:include href = "ga.xslt"; + X:output method="html" version="4.0" indent="no" encoding="utf-8"; X:strip-space elements = "*"; @@ -18,6 +20,9 @@ X:template = "/error" { body { font-family: Georgia, serif; } ') } </style> + + !ga () + </head> <body>
new file mode 100644 --- /dev/null +++ b/xsls/ga.xsls @@ -0,0 +1,22 @@ +X:stylesheet { + +X:template ga () { + + <script type="text/javascript"> + + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-27974099-2']); + _gaq.push(['_setDomainName', 'nginx.org']); + _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> + +} + +}
--- a/xsls/news.xsls +++ b/xsls/news.xsls @@ -19,6 +19,7 @@ X:include href = "link.xslt"; X:include href = "style.xslt"; X:include href = "body.xslt"; X:include href = "menu.xslt"; +X:include href = "ga.xslt"; X:include href = "content.xslt"; @@ -32,6 +33,8 @@ X:template = "/news" { !style (lang="@lang") + !ga () + </head> !body (lang="@lang")
--- a/xsls/security.xsls +++ b/xsls/security.xsls @@ -18,6 +18,7 @@ X:include href = "link.xslt"; X:include href = "style.xslt"; X:include href = "body.xslt"; X:include href = "menu.xslt"; +X:include href = "ga.xslt"; X:include href = "content.xslt"; @@ -28,6 +29,8 @@ X:template = "/article" { !style (lang="@lang") + !ga () + </head> !body (lang="@lang")