Skip to content

Commit f1a6fad

Browse files
committed
Use window.plausible only after component is mounted to allow for SSR.
1 parent 4f22084 commit f1a6fad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

curriculum/.vuepress/components/BottomCallout.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<script>
2-
window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }
32
export default {
43
props: ['title', 'subtitle'],
5-
methods: {
6-
plausibleEvent: function(eventName, props) {
4+
mounted() {
5+
this.plausibleEvent = function(eventName, props) {
76
if (props) {
87
props['path'] = window.location.pathname;
98
} else {
109
props = {
1110
path: window.location.pathname
1211
}
1312
}
14-
window.plausible(eventName, props);
13+
var plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) };
14+
plausible(eventName, props);
1515
}
1616
}
1717
}

0 commit comments

Comments
 (0)