1.0.4 • Published 3 years ago

gulp-gtm-plugin v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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)
})