Name: google-gtag
Owner: Nuxt Community
Description: Enable google gtagjs for NuxtJs
Created: 2018-05-11 03:45:11.0
Updated: 2018-05-17 07:22:08.0
Pushed: 2018-05-17 07:22:07.0
Size: 889
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Google official gtagjs for Nuxt.js
The module includes Google googletagmanager.com/gtag/js
into your project and enables it with config you pass in as options.
@nuxtjs/google-gtag
dependency using yarn or npm to your project@nuxtjs/google-gtag
to modules
section of nuxt.config.js
dules: [
// Simple usage
'@nuxtjs/google-gtag',
// With options
['@nuxtjs/google-gtag', { /* module options */ }],
example config
ogle-gtag':{
d: 'UA-XXXX-XX', // required
onfig:{
// this are the config options for `gtag
// check out official docs: https://developers.google.com/analytics/devguides/collection/gtagjs/
anonymize_ip: true, // anonymize IP
send_page_view: false, // might be necessary to avoid duplicated page track on page reload
linker:{
domains:['domain.com','domain.org']
}
,
ebug: true, // enable to track in dev mode
isableAutoPageTrack: false // disable if you don't want to track each page route with router.afterEach(...)
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:
is.$gtag('event', 'your_event', { /* track something awesome */})
Install Google Tag Assistant
and see if your page is being tracked.
yarn install
or npm install
npm run dev
Copyright (c) Dominic Garms djgarms@gmail.com