Change 'scripts' to 'ga' for google analytics specific config.

This commit is contained in:
Dominik Picheta 2018-05-22 22:49:34 +01:00
commit 2f2d83b86c
3 changed files with 13 additions and 4 deletions

View file

@ -11,12 +11,21 @@
<link rel="stylesheet" href="/css/nimforum.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.12/css/all.css" integrity="sha384-G0fIWCsCzJIMAVNQPfjH08cyYaUtMwjJwqiRKxxE/rx96Uroj1BtIQ6MLJuheaO9" crossorigin="anonymous">
<link rel="icon" href="/images/favicon.png">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=$ga"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '$ga');
</script>
</head>
<body>
<div id="ROOT" />
<script type="text/javascript" src="/js/forum.js?t=$timestamp"></script>
$scripts
</body>
</html>

View file

@ -267,7 +267,7 @@ proc initialise() =
{
"title": config.title,
"timestamp": encodeUrl(CompileDate & CompileTime),
"scripts": config.scripts
"ga": config.ga
}.newStringTable()

View file

@ -28,7 +28,7 @@ type
dbPath*: string
hostname*: string
name*, title*: string
scripts*: string
ga*: string
ForumError* = object of Exception
data*: PostError
@ -65,7 +65,7 @@ proc loadConfig*(filename = getCurrentDir() / "forum.json"): Config =
result.hostname = root["hostname"].getStr()
result.name = root["name"].getStr()
result.title = root["title"].getStr()
result.scripts = root{"scripts"}.getStr()
result.ga = root{"ga"}.getStr()
proc processGT(n: XmlNode, tag: string): (int, XmlNode, string) =
result = (0, newElement(tag), tag)