hard code google analytics id

This commit is contained in:
Raymond Wang 2022-10-24 18:10:51 -07:00
parent 66fadde8da
commit 14633ea47d
3 changed files with 2 additions and 14 deletions

View file

@ -22,8 +22,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Use production environment specified in GitHub settings # Use production environment specified in GitHub settings
environment: production environment: production
env:
GOOGLE_ANALYTICS_ID: ${{ secrets.GOOGLE_ANALYTICS_ID }}
# Steps represent a sequence of tasks that will be executed as part of the job # Steps represent a sequence of tasks that will be executed as part of the job
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it

View file

@ -18,12 +18,6 @@ const TEMPLATE = fs
.readFileSync(path.join(__dirname, "template.html")) .readFileSync(path.join(__dirname, "template.html"))
.toString(); .toString();
const GOOGLE_ANALYTICS_ID = process.env.GOOGLE_ANALYTICS_ID;
if (!GOOGLE_ANALYTICS_ID && process.env.NODE_ENV == "production") {
throw new Error("GOOGLE_ANALYTICS_ID environment variable not defined");
}
const WEBSITES = [ const WEBSITES = [
{ {
sitename: "index", sitename: "index",
@ -106,10 +100,6 @@ function generatePage(name: string): string {
for (key of Object.keys(site)) { for (key of Object.keys(site)) {
html = html.replace(new RegExp("\\$" + key.toUpperCase()), site[key]); html = html.replace(new RegExp("\\$" + key.toUpperCase()), site[key]);
} }
html = html.replace(
new RegExp("$GOOGLE_ANALYTICS_ID", "gm"),
GOOGLE_ANALYTICS_ID
);
return html; return html;
} }

View file

@ -10,13 +10,13 @@
<meta name="description" content="$DESCRIPTION"> <meta name="description" content="$DESCRIPTION">
<meta name="theme-color" content="$THEMECOLOR"> <meta name="theme-color" content="$THEMECOLOR">
<!-- Google tag (gtag.js) --> <!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=$GOOGLE_ANALYTICS_ID"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-85129590-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); } function gtag() { dataLayer.push(arguments); }
gtag('js', new Date()); gtag('js', new Date());
gtag('config', '$GOOGLE_ANALYTICS_ID'); gtag('config', 'UA-85129590-1');
</script> </script>
</head> </head>