By | Chris Done |
At | 2011-10-12 |
Title | Add back google analytics. |
Description |
Edit file src/Amelie/View/Layout.hs 33188 → 33188
13 13 14 14 import Data.Monoid.Operator ((++))
15 15 import Prelude hiding ((++))
16 16 import Text.Blaze.Html5 as H hiding (map,nav)
17 17 import qualified Text.Blaze.Html5.Attributes as A
+ 18 import Text.Blaze (preEscapedText)
18 19 19 20 -- | Render the page in a layout.
20 21 layoutPage :: Page -> Html
21 22 layoutPage Page{..} = do
22 23 docTypeHtml $ do
… … … … 27 28 js "amelie.js"
28 29 js "highlight.pack.js"
29 30 title $ toHtml $ pageTitle ++ " :: hpaste — Haskell Pastebin"
30 31 script $
31 32 "hljs.tabReplace = ' ';hljs.initHighlightingOnLoad();"
- 32 body ! A.id (toValue pageName) $
+ 33 body ! A.id (toValue pageName) $ do
33 34 wrap $ do
34 35 nav
35 36 logo
36 37 pageBody
37 38 foot
+ 39 preEscapedText "<script type=\"text/javascript\"> var _gaq = _gaq \
+ 40 \|| []; _gaq.push(['_setAccount', 'UA-7443395-10']);\
+ 41 \ _gaq.push(['_trackPageview']); (function() {var ga\
+ 42 \ = document.createElement('script'); ga.type = 'tex\
+ 43 \t/javascript'; ga.async = true; ga.src = ('https:' \
+ 44 \== document.location.protocol ? 'https://ssl' : \
+ 45 \'http://www') + '.google-analytics.com/ga.js'; var\
+ 46 \ s = document.getElementsByTagName('script')[0]; \
+ 47 \s.parentNode.insertBefore(ga, s);})(); </script>"
38 48 39 49 where js s = script ! A.type_ "text/javascript"
40 50 ! A.src ("/js/" ++ s) $
41 51 return ()
42 52 … … … …