From 4594f7efc278e637b1f62aeb93987f1c87d8f365 Mon Sep 17 00:00:00 2001 From: "r.bideau" <7304827+rbideau@users.noreply.github.com> Date: Thu, 18 Feb 2021 17:13:00 +0100 Subject: [PATCH] Add google analytics scripts in template for standalone app Signed-off-by: r.bideau <7304827+rbideau@users.noreply.github.com> --- .changeset/mighty-masks-hear.md | 29 +++++++++++++++++++ .../packages/app/public/index.html | 16 ++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .changeset/mighty-masks-hear.md diff --git a/.changeset/mighty-masks-hear.md b/.changeset/mighty-masks-hear.md new file mode 100644 index 0000000000..bb19be1420 --- /dev/null +++ b/.changeset/mighty-masks-hear.md @@ -0,0 +1,29 @@ +--- +'@backstage/create-app': patch +--- + +Add the google analytics scripts in the `index.html` template for new applications. + +To apply this change to an existing application, change the following in `packages\app\public\index.html`: + +```diff + <%= app.title %> + ++ <% if (app.googleAnalyticsTrackingId && typeof app.googleAnalyticsTrackingId ++ === 'string') { %> ++ ++ ++ <% } %> + +``` diff --git a/packages/create-app/templates/default-app/packages/app/public/index.html b/packages/create-app/templates/default-app/packages/app/public/index.html index ea9208ca57..5653173480 100644 --- a/packages/create-app/templates/default-app/packages/app/public/index.html +++ b/packages/create-app/templates/default-app/packages/app/public/index.html @@ -48,6 +48,22 @@ } <%= app.title %> + <% if (app.googleAnalyticsTrackingId && typeof app.googleAnalyticsTrackingId + === 'string') { %> + + + <% } %>