Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yurayarosh/gulp-gtm-plugin

Add Google Tag Manager support to your web project.
https://github.com/yurayarosh/gulp-gtm-plugin

Last synced: about 2 months ago
JSON representation

Add Google Tag Manager support to your web project.

Awesome Lists containing this project

README

        

# Gulp Google Tag Manager Plugin

So that is basically [webpack-google-tag-manager-plugin](https://github.com/timjorjev/webpack-google-tag-manager-plugin),
but fixed some bugs and made it to use with gulp.

## Installation

```bash
$ npm i gulp-gtm-plugin -D
```

```bash
$ yarn add gulp-gtm-plugin -D
```

## How to use

```js
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

```js
gtm({
id: '',
events: {},
dataLayer: {},
dataLayerName: 'dataLayer',
auth: '',
preview: '',
cookiesWin: '', // Add `gtm_cookies_win` query to url (cookiesWin: 'x' => gtm_cookies_win=x)
})
```