@nuxtjs/google-gtag
Google official gtagjs for Nuxt.js
📖 Release Notes
Features
The module includes Google googletagmanager.com/gtag/js
into your project and enables it with config you pass in as options.
- Check the official reference gtag
Setup
- Add
@nuxtjs/google-gtag
dependency using yarn or npm to your project - Add
@nuxtjs/google-gtag
to modules
section of nuxt.config.js
{
modules: [
'@nuxtjs/google-gtag',
['@nuxtjs/google-gtag', { }],
]
'google-gtag':{
id: 'UA-XXXX-XX',
config:{
anonymize_ip: true,
send_page_view: false,
linker:{
domains:['domain.com','domain.org']
}
},
debug: true,
disableAutoPageTrack: false,
additionalAccounts:[{
id: 'AW-XXXX-XX',
config:{
send_page_view:false
}
}]
}
}
Usage
This module inlcudes Google gtag in your NuxtJs project and enables every page tracking by default. You can use gtag inside of your components/functions/methods like follow:
this.$gtag('event', 'your_event', { /* track something awesome */})
Check functionalities
Install Google Tag Assistant
and see if your page is being tracked.
Development
- Clone this repository
- Install dependencies using
yarn install
or npm install
- Start development server using
npm run dev
License
MIT License
Copyright (c) Dominic Garms djgarms@gmail.com