Skip to content

Commit 53b4eea

Browse files
committed
Better analytics on demo page
1 parent 9fbabbe commit 53b4eea

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"jest-serializer-vue": "^2.0.2",
6161
"lint-staged": "10.3.0",
6262
"nuxt": "^2.12.2",
63-
"plausible-tracker": "^0.2.2",
63+
"plausible-tracker": "^0.3.1",
6464
"prettier": "^2.0.5",
6565
"prismjs": "^1.20.0",
6666
"rollup": "^2.11.2",

public/components/EthicalAds.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
:data-ea-type="type"
55
data-ea-publisher="maronato-github-iovue-toastification"
66
data-ea-keywords="vue|frontend|design|javascript|typescript"
7+
@click="track()"
78
/>
89
</template>
910

1011
<script>
12+
import { trackEvent } from "../plausible";
1113
export default {
1214
props: {
1315
adId: {
@@ -19,5 +21,15 @@ export default {
1921
default: "text",
2022
},
2123
},
24+
methods: {
25+
track() {
26+
trackEvent("Ad click", {
27+
props: {
28+
placement: this.adId,
29+
type: this.type,
30+
},
31+
});
32+
},
33+
},
2234
};
2335
</script>

public/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Vue from "vue";
2-
import { enableAutoPageviews } from "./plausible";
2+
import { enableAutoPageviews, enableAutoOutboundTracking } from "./plausible";
33
import vuetify from "./vuetify";
44
import App from "./App.vue";
55
import Toast from "../src/index";
@@ -9,6 +9,7 @@ Vue.config.productionTip = false;
99
Vue.use(Toast);
1010

1111
enableAutoPageviews();
12+
enableAutoOutboundTracking();
1213

1314
new Vue({
1415
vuetify,

public/plausible.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import Plausible from "plausible-tracker";
22

3-
export const { enableAutoPageviews, trackEvent } = Plausible({
3+
export const {
4+
enableAutoPageviews,
5+
trackEvent,
6+
enableAutoOutboundTracking,
7+
} = Plausible({
48
domain: "maronato.github.io/vue-toastification",
59
apiHost: "https://plausible.maronato.dev",
610
});

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9851,10 +9851,10 @@ pkg-up@^3.1.0:
98519851
dependencies:
98529852
find-up "^3.0.0"
98539853

9854-
plausible-tracker@^0.2.2:
9855-
version "0.2.2"
9856-
resolved "https://registry.yarnpkg.com/plausible-tracker/-/plausible-tracker-0.2.2.tgz#bdbbad038816bac5b14b5b2216a48c5ddec59598"
9857-
integrity sha512-DxTszs9U2GAGg799TXL/w4uRRSoxcBt9v08zQgQVrs1SYlR0c+fPFXKuN1lv6RPTSIiQ7/UbXteR4GWz/bcLRA==
9854+
plausible-tracker@^0.3.1:
9855+
version "0.3.1"
9856+
resolved "https://registry.yarnpkg.com/plausible-tracker/-/plausible-tracker-0.3.1.tgz#dd4e1f59cafc7bf1b00e30890567287b3f204efd"
9857+
integrity sha512-oXnVyfTF2gzkfK3iOZCRZEnf8sH4gBASaJhY+clwWW1orIybfQpfbgg4U5Bwj5dW/4iNstM4tx4jMCVUfMCUbg==
98589858

98599859
please-upgrade-node@^3.2.0:
98609860
version "3.2.0"

0 commit comments

Comments
 (0)