Skip to content

Commit e2c57f4

Browse files
chore(playground): enable form submissions
1 parent 1e03d61 commit e2c57f4

File tree

2 files changed

+57
-8
lines changed

2 files changed

+57
-8
lines changed

playground/app.vue

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,27 @@ function trackEvent() {
2020
props: {
2121
action: 'click',
2222
},
23-
callback() {
24-
console.log('Event tracked')
23+
callback(result) {
24+
console.log('Event tracked', result)
25+
},
26+
})
27+
}
28+
29+
function trackNonInteractiveEvent() {
30+
useTrackEvent('background-task', {
31+
interactive: false,
32+
callback(result) {
33+
console.log('Non-interactive event tracked', result)
34+
},
35+
})
36+
}
37+
38+
function trackRevenue() {
39+
useTrackEvent('Purchase', {
40+
revenue: { amount: 29.99, currency: 'USD' },
41+
props: { plan: 'Pro' },
42+
callback(result) {
43+
console.log('Revenue event tracked', result)
2544
},
2645
})
2746
}
@@ -47,19 +66,38 @@ function pushRoute() {
4766
</details>
4867

4968
<h3>Composables</h3>
50-
<p>
69+
<div class="button-group">
5170
<button @click="trackEvent">
5271
useTrackEvent
5372
</button>
54-
&nbsp;
73+
<button @click="trackNonInteractiveEvent">
74+
Non-interactive Event
75+
</button>
76+
<button @click="trackRevenue">
77+
Revenue Event
78+
</button>
5579
<button @click="trackPageview">
5680
useTrackPageview
5781
</button>
58-
&nbsp;
5982
<button @click="pushRoute">
6083
navigateTo
6184
</button>
62-
</p>
85+
</div>
86+
87+
<h3>File Downloads</h3>
88+
<ul>
89+
<li><a href="/test.pdf">Download PDF</a></li>
90+
<li><a href="/test.zip">Download ZIP</a></li>
91+
</ul>
92+
93+
<h3>Form Submissions</h3>
94+
<form @submit.prevent>
95+
<label>Email: <input type="email" name="email" placeholder="test@example.com"></label>
96+
&nbsp;
97+
<button type="submit">
98+
Submit
99+
</button>
100+
</form>
63101

64102
<h3>Links</h3>
65103
<ul>
@@ -78,3 +116,11 @@ function pushRoute() {
78116
</li>
79117
</ul>
80118
</template>
119+
120+
<style>
121+
.button-group {
122+
display: flex;
123+
flex-wrap: wrap;
124+
gap: 0.5rem;
125+
}
126+
</style>

playground/nuxt.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ export default defineNuxtConfig({
88
plausible: {
99
// Enable tracking events on localhost
1010
ignoredHostnames: [],
11-
autoPageviews: false,
12-
autoOutboundTracking: false,
11+
autoPageviews: true,
12+
autoOutboundTracking: true,
13+
fileDownloads: true,
14+
formSubmissions: true,
15+
logIgnoredEvents: true,
1316
proxy: true,
1417
},
1518
})

0 commit comments

Comments
 (0)