From fac820aecdb477e5ebf31647f964ff517ec0b4d8 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sat, 29 Jul 2017 17:23:40 -0400 Subject: [PATCH] Adding Google Analytics during build instead of with mod_pagespeed --- gulpfile.js | 5 +++++ lib/partials/google_analytics.hbs | 11 +++++++++++ lib/partials/layout.hbs | 2 ++ 3 files changed, 18 insertions(+) create mode 100644 lib/partials/google_analytics.hbs diff --git a/gulpfile.js b/gulpfile.js index df0854b..bd8c26d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -72,6 +72,11 @@ gulp.task('markup', 'Build markup into ./build directory.', ['webpack'], functio hbStream.partials({ svg_styles: fs.readFileSync(__dirname + '/build/css/svg.css').toString() }); + if (process.env.GA_PROP) { + hbStream.data({ + 'gaPropertyId': process.env.GA_PROP + }); + } return gulp.src(config.globs.templates) .pipe(frontMatter()) .pipe(hbStream) diff --git a/lib/partials/google_analytics.hbs b/lib/partials/google_analytics.hbs new file mode 100644 index 0000000..fffd7eb --- /dev/null +++ b/lib/partials/google_analytics.hbs @@ -0,0 +1,11 @@ +{{#if gaPropertyId}} + +{{/if}} diff --git a/lib/partials/layout.hbs b/lib/partials/layout.hbs index b1a3d2a..356b857 100644 --- a/lib/partials/layout.hbs +++ b/lib/partials/layout.hbs @@ -10,6 +10,8 @@ + {{> "google_analytics"}} +