Skip to content

Commit ec4a3db

Browse files
committed
adds fathom support, closes #66
1 parent a8ab954 commit ec4a3db

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

vue/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
VUE_APP_GRAPHQL_URI=http://www:8000/graphql/
22
VUE_APP_DJANGOBASEURL=http://www:8000
3+
VUE_APP_FATHOM_SITEID=GYFGUGON

vue/.env.production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
VUE_APP_GRAPHQL_URI=/graphql/
22
VUE_APP_DJANGOBASEURL=
3+
VUE_APP_FATHOM_SITEID=

vue/src/App.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ import LayoutDefault from '@/layouts/LayoutDefault.vue';
2020
2121
export default {
2222
data() {
23-
return {};
23+
return {
24+
fathomSiteId: process.env.VUE_APP_FATHOM_SITEID
25+
};
2426
},
2527
2628
created() {
@@ -36,6 +38,18 @@ export default {
3638
}
3739
},
3840
41+
mounted() {
42+
if (this.fathomSiteId !== '') {
43+
const fathomScript = document.createElement('script');
44+
fathomScript.setAttribute('src', 'https://cdn.usefathom.com/script.js');
45+
fathomScript.setAttribute('spa', 'auto');
46+
fathomScript.setAttribute('data-site', this.fathomSiteId);
47+
fathomScript.setAttribute('exluded-domains', 'www,www.local,localhost');
48+
fathomScript.setAttribute('defer', true);
49+
document.head.appendChild(fathomScript);
50+
}
51+
},
52+
3953
methods: {
4054
setInitialSnapshotnav() {
4155
if (this.$route.params.hash) {

0 commit comments

Comments
 (0)