analytics.html 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {{ define "layout" }}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head></head>
  5. <body>
  6. <style type="text/css">
  7. .tg {border-collapse:collapse;border-spacing:0;}
  8. .tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px; overflow:hidden;padding:10px 5px;word-break:normal;}
  9. .tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px; font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
  10. .tg .tg-0lax{text-align:left;vertical-align:top}
  11. </style>
  12. <script>
  13. function UpdateQueryString(key, value, url) {
  14. if (!url) url = window.location.href;
  15. var re = new RegExp("([?&])" + key + "=.*?(&|#|$)(.*)", "gi"),
  16. hash;
  17. if (re.test(url)) {
  18. if (typeof value !== 'undefined' && value !== null) {
  19. return url.replace(re, '$1' + key + "=" + value + '$2$3');
  20. }
  21. else {
  22. hash = url.split('#');
  23. url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, '');
  24. if (typeof hash[1] !== 'undefined' && hash[1] !== null) {
  25. url += '#' + hash[1];
  26. }
  27. return url;
  28. }
  29. }
  30. else {
  31. if (typeof value !== 'undefined' && value !== null) {
  32. var separator = url.indexOf('?') !== -1 ? '&' : '?';
  33. hash = url.split('#');
  34. url = hash[0] + separator + key + '=' + value;
  35. if (typeof hash[1] !== 'undefined' && hash[1] !== null) {
  36. url += '#' + hash[1];
  37. }
  38. return url;
  39. }
  40. else {
  41. return url;
  42. }
  43. }
  44. }
  45. function chooseDate(object) {
  46. window.location.href = UpdateQueryString("date", object.value, window.location.href)
  47. }
  48. </script>
  49. <section id="about">
  50. <div class="container-fluid align-self-center">
  51. <div class="row d-flex justify-content-center">
  52. <div class="col-12 text-center align-self-center">
  53. <h1>{{.Date}}</h1>
  54. <input type="date" id="date" value="{{.Date}}" onchange="chooseDate(this)">
  55. <h2>Unique Sessions Today: {{.SessionCount}}</h2>
  56. <h3>Page Views</h3>
  57. {{range $Category, $URLS := .URLHits}}
  58. <h5> /{{$Category}}</h5>
  59. <table class="tg" style="undefined;table-layout: fixed; width: 320px">
  60. <colgroup>
  61. <col style="width: 70px">
  62. <col style="width: 250px">
  63. </colgroup>
  64. <thead>
  65. <tr>
  66. <th class="tg-0lax">Page Views</th>
  67. <th class="tg-0lax">URL</th>
  68. </tr>
  69. </thead>
  70. <tbody>
  71. {{range $URL, $count := $URLS}}
  72. <tr>
  73. <td class="tg-0lax">{{$count}} </td>
  74. <td class="tg-0lax">{{$URL}}</td>
  75. </tr>
  76. {{end}}
  77. </tbody>
  78. </table>
  79. {{ end }}
  80. </div>
  81. </div>
  82. </div>
  83. </section>
  84. </body>
  85. </html>
  86. {{ end }}