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 1/4] 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') { %> + + + <% } %> From 24b59505d0d978f54a0fe049bbe1a203e928dddb Mon Sep 17 00:00:00 2001 From: "r.bideau" <7304827+rbideau@users.noreply.github.com> Date: Sun, 21 Feb 2021 20:41:44 +0100 Subject: [PATCH 2/4] Moves google analytics docs in an integration section - with a link to it in the observability page. - documents the default behavior and add a link to the GA developer guides Signed-off-by: r.bideau <7304827+rbideau@users.noreply.github.com> --- .../google-analytics/installation.md | 23 +++++++++++++++++++ docs/plugins/observability.md | 14 ++--------- 2 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 docs/integrations/google-analytics/installation.md diff --git a/docs/integrations/google-analytics/installation.md b/docs/integrations/google-analytics/installation.md new file mode 100644 index 0000000000..759cfa3ed1 --- /dev/null +++ b/docs/integrations/google-analytics/installation.md @@ -0,0 +1,23 @@ +--- +id: installation +title: Google Analytics Installation +# prettier-ignore +description: Adding Google Analytics to Your App +--- + +There is a basic Google Analytics integration built into Backstage. You can +enable it by adding the following to your app configuration: + +```yaml +app: + googleAnalyticsTrackingId: UA-000000-0 +``` + +Replace the tracking ID with your own. + +For more information, learn about Google Analytics +[here](https://marketingplatform.google.com/about/analytics/). + +The default behavior is only to send a pageview hit to Google Analytics. To +record more, look at the developer documentation +[here](https://developers.google.com/analytics/devguides/collection/gtagjs). diff --git a/docs/plugins/observability.md b/docs/plugins/observability.md index 8b6668606f..de6f4bf988 100644 --- a/docs/plugins/observability.md +++ b/docs/plugins/observability.md @@ -10,18 +10,8 @@ Backstage integrator. ## Google Analytics -There is a basic Google Analytics integration built into Backstage. You can -enable it by adding the following to your app configuration: - -```yaml -app: - googleAnalyticsTrackingId: UA-000000-0 -``` - -Replace the tracking ID with your own. - -For more information, learn about Google Analytics -[here](https://marketingplatform.google.com/about/analytics/). +See how to install Google Analytics in your app +[here](../integrations/google-analytics/installation.md) ## Logging From 24779db8bfe0195869dfcd6f97184509d506f12f Mon Sep 17 00:00:00 2001 From: "r.bideau" <7304827+rbideau@users.noreply.github.com> Date: Mon, 22 Feb 2021 09:45:44 +0100 Subject: [PATCH 3/4] Add pageview to vocab Signed-off-by: r.bideau <7304827+rbideau@users.noreply.github.com> --- .github/styles/vocab.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/styles/vocab.txt b/.github/styles/vocab.txt index 2a8854b8a2..bf6dfb4451 100644 --- a/.github/styles/vocab.txt +++ b/.github/styles/vocab.txt @@ -204,6 +204,7 @@ octokit oidc onboarding pagerduty +pageview parallelization plantuml postgres From 72722c1f6cfe43cf6b5b73dfa96ec888b018c941 Mon Sep 17 00:00:00 2001 From: "r.bideau" <7304827+rbideau@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:31:59 +0100 Subject: [PATCH 4/4] Add Google Analytics installation to sidebars and mkdocs Signed-off-by: r.bideau <7304827+rbideau@users.noreply.github.com> --- docs/integrations/google-analytics/installation.md | 1 + microsite/sidebars.json | 5 +++++ mkdocs.yml | 2 ++ 3 files changed, 8 insertions(+) diff --git a/docs/integrations/google-analytics/installation.md b/docs/integrations/google-analytics/installation.md index 759cfa3ed1..a0e6f69d13 100644 --- a/docs/integrations/google-analytics/installation.md +++ b/docs/integrations/google-analytics/installation.md @@ -1,6 +1,7 @@ --- id: installation title: Google Analytics Installation +sidebar_label: Installation # prettier-ignore description: Adding Google Analytics to Your App --- diff --git a/microsite/sidebars.json b/microsite/sidebars.json index 0b3c8f5915..799433b8ef 100644 --- a/microsite/sidebars.json +++ b/microsite/sidebars.json @@ -112,6 +112,11 @@ "type": "subcategory", "label": "LDAP", "ids": ["integrations/ldap/org"] + }, + { + "type": "subcategory", + "label": "Google Analytics", + "ids": ["integrations/google-analytics/installation"] } ], "Plugins": [ diff --git a/mkdocs.yml b/mkdocs.yml index 00824392a7..6b1971ce03 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -70,6 +70,8 @@ nav: - Org Data: 'integrations/github/org.md' - LDAP: - Org Data: 'integrations/ldap/org.md' + - Google Analytics: + - Installation: 'integrations/google-analytics/installation.md' - Plugins: - Overview: 'plugins/index.md' - Existing plugins: 'plugins/existing-plugins.md'