/gulp-ga

Adds google analystics code into html file

Primary LanguageJavaScriptMIT LicenseMIT

gulp-ga

Adds Google Analytics code into HTML files.

Information

Packagegulp-ga
Description Insert Google Analytics code into HTML with Gulp (gulpjs.com)
Node Version >= 0.9
Gulp Version 3.x

Usage

Install

$ npm install gulp-ga --save-dev

Example

var gulp = require('gulp');
var ga = require('gulp-ga');

// Basic usage:
gulp.task('ga', function(){
  gulp.src('./index.html')
  .pipe(ga({url: 'mydomain.com', uid: 'UA-12345678-1'}))
  .pipe(gulp.dest('./'));
});

Options

options.url

The page you want analysis (required)

Type: `String`

Example:

.pipe(ga({url: 'mydomain.com'})

options.uid

Set the uid (required)

Type: `String`

Example:

.pipe(ga({uid: 'UA-12345678-1'}))

options.tag

Set a specific tag to insert before it.

Type: `String`
Default: `head`

Example:

.pipe(ga({tag: 'head'}))
.pipe(ga({tag: 'body'}))

options.anonymizeIp

Allow requests IP address anonymization

Type: `Boolean`
Default: `true`

Example:

.pipe(ga({anonymizeIp: false}))

options.demographics

Enable display features.

Type: `Boolean`
Default: `false`

Example:

.pipe(ga({demographics: true}))

options.linkAttribution

Set an enhanced link-tracking functionality.

Type: `Boolean`
Default: `false`

Example:

.pipe(ga({linkAttribution: true}))

options.bounceTime

Set a specific bounce time.

Type: `Number`
Default: `N/A`

Example:

.pipe(ga({bunceTime: 15}))

LICENSE

(MIT License)

Copyright (c) 2014,2015 Zhonghai Zuo zhonghai.zuo@gmail.com zhhz

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.