Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit 1f483f7

Browse files
Merge branch 'master' into master
2 parents eda47b8 + 10325c8 commit 1f483f7

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
Vue plugin for Google Analytics
2323

2424
## Notes
25-
I've published a new plugin called [vue-gtag](https://github.com/MatteoGabriele/vue-gtag) which uses the new gtag.js library for Google Analytics
25+
_I've published a new plugin called [vue-gtag](https://github.com/MatteoGabriele/vue-gtag) which uses the new gtag.js library for Google Analytics._
26+
27+
_The vue-analytics package will soon be deprecated in favor of the new gtag api plugin._
2628

2729
## Why should I use it?
2830

docs/v-ga.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,25 @@ If there's no need to pass any arguments, we could also just pass the name of th
110110
}
111111
</script>
112112
```
113+
114+
### v-ga in v-for loops
115+
'this' is not available on child elements in a v-for loop. To get the current component scope, use '$parent'.
116+
117+
```html
118+
<template>
119+
<div v-for="button in buttons" :key="button.key">
120+
<button v-ga="$ga.commands.trackFocus.bind($parent, button.value)">{{ button.name }}</button>
121+
</div>
122+
</template>
123+
124+
<script>
125+
export default {
126+
name: 'myComponent',
127+
data: () => ({
128+
buttons: [
129+
{ name: 'Click me', value: 1 }
130+
]
131+
})
132+
}
133+
</script>
134+
```

0 commit comments

Comments
 (0)