Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoGabriele authored Dec 10, 2019
2 parents eda47b8 + 10325c8 commit 1f483f7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
Vue plugin for Google Analytics

## Notes
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
_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._

_The vue-analytics package will soon be deprecated in favor of the new gtag api plugin._

## Why should I use it?

Expand Down
22 changes: 22 additions & 0 deletions docs/v-ga.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,25 @@ If there's no need to pass any arguments, we could also just pass the name of th
}
</script>
```

### v-ga in v-for loops
'this' is not available on child elements in a v-for loop. To get the current component scope, use '$parent'.

```html
<template>
<div v-for="button in buttons" :key="button.key">
<button v-ga="$ga.commands.trackFocus.bind($parent, button.value)">{{ button.name }}</button>
</div>
</template>

<script>
export default {
name: 'myComponent',
data: () => ({
buttons: [
{ name: 'Click me', value: 1 }
]
})
}
</script>
```

0 comments on commit 1f483f7

Please sign in to comment.