gulp-gtm-plugin
v1.0.4
Published
Add Google Tag Manager support to your web project.
Downloads
7
Maintainers
Readme
Gulp Google Tag Manager Plugin
So that is basically webpack-google-tag-manager-plugin, but fixed some bugs and made it to use with gulp.
Installation
$ npm i gulp-gtm-plugin -D
$ yarn add gulp-gtm-plugin -D
How to use
const gulp = require('gulp')
const gtm = require('gulp-gtm-plugin')
gulp.task('html', () =>
gulp.src('./index.html')
.pipe(gtm({
id: 'GTM-1234'
}))
.pipe(gulp.dest('./'))
)
Default options
gtm({
id: '',
events: {},
dataLayer: {},
dataLayerName: 'dataLayer',
auth: '',
preview: '',
cookiesWin: '', // Add `gtm_cookies_win` query to url (cookiesWin: 'x' => gtm_cookies_win=x)
})