Browse Source

Changed 404 message and added freshlytics scripts

main
Roxie Gibson 3 years ago
parent
commit
8dd80c416c
No known key found for this signature in database
5 changed files with 38 additions and 3 deletions
  1. +2
    -2
      layouts/404.html
  2. +2
    -0
      layouts/_default/list.html
  3. +2
    -0
      layouts/_default/single.html
  4. +1
    -1
      layouts/index.html
  5. +31
    -0
      layouts/partials/freshlyticsscript.html

+ 2
- 2
layouts/404.html View File

@@ -3,8 +3,8 @@
{{ partial "head.html" . }}

<body>
<p> This page does not exist or as they say, it's a 404 error</p>
<p> If you can't find what you're looking for, it's better to sometimes look inside </p>
<p> Oops! Can't find that page. Sorry!</p>
{{ partial "freshlyticsscript.html" . }}
</body>

</html>

+ 2
- 0
layouts/_default/list.html View File

@@ -14,6 +14,8 @@
{{ partial "listing.html" . }}
{{ end }}
</div>

{{ partial "freshlyticsscript.html" . }}
</body>

</html>

+ 2
- 0
layouts/_default/single.html View File

@@ -12,4 +12,6 @@

{{ partial "footer.html" . }}

{{ partial "freshlyticsscript.html" . }}

</html>

+ 1
- 1
layouts/index.html View File

@@ -39,7 +39,7 @@
<h3><a href="posts/">View all posts</a></h3>
</div>

{{ partial "freshlyticsscript.html" . }}
</body>

</html>

+ 31
- 0
layouts/partials/freshlyticsscript.html View File

@@ -0,0 +1,31 @@
<!-- freshlytics snippet -->

<script>
(function() {
var COLLECT_URL = "https://analytics.roxanne.dev/api/collect";
var PROJECT_ID = "ZUYYDNTR9E";
var GLOBAL_VAR_NAME = "__freshlytics__";

window[GLOBAL_VAR_NAME] = {};

window[GLOBAL_VAR_NAME].sendPageView = function() {
var path = location.pathname;
var referrer = document.referrer;

var url =
COLLECT_URL +
"?project_id=" +
PROJECT_ID +
"&path=" +
encodeURIComponent(path) +
"&referrer=" +
encodeURIComponent(referrer);

var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.send();
};

window[GLOBAL_VAR_NAME].sendPageView();
})();
</script>

Loading…
Cancel
Save