Commit f76743b912a0a02571f133b4ebd9542fd6838d86
1 parent
51ee4ec6
Exists in
master
and in
6 other branches
Add google analytics
Showing
2 changed files
with
15 additions
and
0 deletions
Show diff stats
gulp/build.js
... | ... | @@ -62,6 +62,19 @@ gulp.task('html', ['inject', 'partials'], function () { |
62 | 62 | .pipe($.useref()) |
63 | 63 | .pipe($.revReplace()) |
64 | 64 | .pipe(htmlFilter) |
65 | + // production | |
66 | + .pipe($.if($.util.env.production, $.replace('<!-- INJECT-GOOGLE-ANALYTICS -->', ([ | |
67 | + '<script>', | |
68 | + ' (function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){', | |
69 | + ' (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),', | |
70 | + ' m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)', | |
71 | + ' })(window,document,"script","//www.google-analytics.com/analytics.js","ga");', | |
72 | + ' ga("create", "UA-68205875-1", "auto");', | |
73 | + ' ga("send", "pageview");', | |
74 | + '</script>' | |
75 | + ]).join('\n')))) | |
76 | + // staging | |
77 | + // .pipe($.if($.util.env.staging, $.replace('<!-- INJECT-GOOGLE-ANALYTICS -->', ''))) | |
65 | 78 | .pipe($.minifyHtml({ |
66 | 79 | empty: true, |
67 | 80 | spare: true, | ... | ... |
src/index.html
... | ... | @@ -63,5 +63,7 @@ |
63 | 63 | <script src='//feedback.participa.br/widget/gAC1MNc2MYVOzEmnElaeVQ'></script> |
64 | 64 | <script defer="defer" src="http://barra.brasil.gov.br/barra.js" type="text/javascript"></script> |
65 | 65 | <script defer="defer" src="http://captcha2.servicoscorporativos.serpro.gov.br/js/captcha.serpro.gov.br.js"></script> |
66 | + | |
67 | + <!-- INJECT-GOOGLE-ANALYTICS --> | |
66 | 68 | </body> |
67 | 69 | </html> | ... | ... |