Skip to content
Permalink
Browse files

Store ga tracking id into an env variable

  • Loading branch information...
marcomontalbano committed Sep 19, 2019
1 parent af78086 commit 3031aefd8bb747c14d6d621151f8da401ecf3ec4
Showing with 7 additions and 4 deletions.
  1. +1 −0 .env.sample
  2. +1 −1 package-lock.json
  3. +1 −1 package.json
  4. +1 −1 src/index.html
  5. +3 −1 src/lambda/classes/google-ua.js
@@ -3,3 +3,4 @@ CLOUDINARY_CLOUD_NAME=
FACEBOOK_ACCESS_TOKEN=
SITE_ID=
NETLIFY_ACCESS_TOKEN=
GA_TRACKING_ID=

Some generated files are not rendered by default. Learn more.

@@ -1,6 +1,6 @@
{
"name": "video-to-markdown",
"version": "1.3.0",
"version": "1.4.0",
"private": true,
"description": "How to embed a video in markdown? Here the answer. Add videos to your markdown files easier.",
"homepage": "https://video-to-markdown.netlify.com/",
@@ -30,7 +30,7 @@
var isProd = location.hostname === 'video-to-markdown.netlify.com';
if (isProd) {
window.ga = window.ga || function () { (ga.q = ga.q || []).push(arguments) }; ga.l = +new Date;
ga('create', 'UA-50467643-11', 'auto');
ga('create', process.env.GA_TRACKING_ID, 'auto');
ga('send', 'pageview');
}
})();
@@ -1,7 +1,9 @@
const ua = require('universal-analytics');
const visitor = ua('UA-50467643-11');
const path = require('path');

const { GA_TRACKING_ID } = process.env;
const visitor = ua(GA_TRACKING_ID);

const sendEvent = (...args) => {
visitor.event(...args).send();
}

0 comments on commit 3031aef

Please sign in to comment.
You can’t perform that action at this time.