Skip to content

Commit

Permalink
Store ga tracking id into an env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomontalbano committed Sep 19, 2019
1 parent af78086 commit 9d757d6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .env.sample
Expand Up @@ -3,3 +3,4 @@ CLOUDINARY_CLOUD_NAME=
FACEBOOK_ACCESS_TOKEN=
SITE_ID=
NETLIFY_ACCESS_TOKEN=
GA_TRACKING_ID=
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -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/",
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Expand Up @@ -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');
}
})();
Expand Down
4 changes: 3 additions & 1 deletion src/lambda/classes/google-ua.js
@@ -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();
}
Expand Down

0 comments on commit 9d757d6

Please sign in to comment.