Skip to content

Commit 2621b84

Browse files
committed
doc: broken script usage
Fixes #438
1 parent 46c5b85 commit 2621b84

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

docs/content/docs/1.guides/1.registry-scripts.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ using different configuration.
121121
By default, they will be deduped and only loaded once, to load multiple instances of the same script, you can provide a unique `key` to the script.
122122

123123
```ts
124-
const { gtag, $script } = useScriptGoogleAnalytics({
124+
const { proxy: gaOne } = useScriptGoogleAnalytics({
125125
id: 'G-TR58L0EF8P',
126126
})
127127

128-
const { gtag: gtag2, $script: $script2 } = useScriptGoogleAnalytics({
128+
const { proxy: gaTwo } = useScriptGoogleAnalytics({
129129
// without a key the first script instance will be returned
130130
key: 'gtag2',
131131
id: 'G-1234567890',
@@ -200,11 +200,11 @@ export default defineNuxtConfig({
200200

201201
```vue [components/any-component.vue]
202202
<script setup lang="ts">
203-
const { trackGoal } = useScriptFathomAnalytics() // no options required
203+
const { proxy } = useScriptFathomAnalytics() // no options required
204204
</script>
205205
206206
<template>
207-
<button @click="trackGoal('GOAL_ID')">
207+
<button @click="proxy.trackGoal('GOAL_ID')">
208208
Track Goal
209209
</button>
210210
</template>

docs/content/docs/1.guides/1.script-triggers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ The [useScriptTriggerElement](/docs/api/use-script-trigger-element) composable a
6565

6666
```ts
6767
const somethingEl = ref<HTMLElement>()
68-
const { trigger } = useScript({
68+
const script = useScript({
6969
src: 'https://example.com/script.js',
7070
}, {
7171
trigger: useScriptTriggerElement({

docs/content/scripts/analytics/umami-analytics.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,14 @@ Using Umami Analytics only in production while using `track` to send a conversio
144144

145145
```vue [ConversionButton.vue]
146146
<script setup lang="ts">
147-
const { track } = useScriptUmamiAnalytics()
147+
const { proxy } = useScriptUmamiAnalytics()
148148
149149
// noop in development, ssr
150150
// just works in production, client
151-
track('event', { name: 'conversion-step' })
151+
proxy.track('event', { name: 'conversion-step' })
152152
153153
function sendConversion() {
154-
track('event', { name: 'conversion' })
154+
proxy.track('event', { name: 'conversion' })
155155
}
156156
</script>
157157

docs/content/scripts/marketing/hotjar.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ Using Hotjar only in production while using `hj` to send a conversion event.
119119

120120
```vue [ConversionButton.vue]
121121
<script setup lang="ts">
122-
const { hj } = useScriptHotjar()
122+
const { proxy } = useScriptHotjar()
123123
124124
// noop in development, ssr
125125
// just works in production, client
126126
function sendConversion() {
127-
hj('event', 'conversion')
127+
proxy.hj('event', 'conversion')
128128
}
129129
</script>
130130

docs/content/scripts/tracking/google-tag-manager.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,13 @@ Using Google Tag Manager only in production while using `dataLayer` to send a co
171171
172172
```vue [ConversionButton.vue]
173173
<script setup lang="ts">
174-
const { dataLayer } = useScriptGoogleTagManager()
174+
const { proxy } = useScriptGoogleTagManager()
175175

176176
// noop in development, ssr
177177
// just works in production, client
178-
dataLayer.push({ event: 'conversion-step', value: 1 })
178+
proxy.dataLayer.push({ event: 'conversion-step', value: 1 })
179179
function sendConversion() {
180-
dataLayer.push({ event: 'conversion', value: 1 })
180+
proxy.dataLayer.push({ event: 'conversion', value: 1 })
181181
}
182182
</script>
183183

0 commit comments

Comments
 (0)