From f9598e8c802387ad38ac5cb53283a87116e12dd2 Mon Sep 17 00:00:00 2001 From: Yufei Huang Date: Fri, 5 May 2023 09:39:48 +0800 Subject: [PATCH 1/2] feat: enable google analytics with _googleAnalyticsTagId --- docs/docfx.json | 3 ++- docs/docs/template.md | 3 ++- templates/modern/layout/_master.tmpl | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/docfx.json b/docs/docfx.json index 9f3a4791590..ab4ad272af2 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -30,7 +30,8 @@ "globalMetadata": { "_appTitle": "docfx", "_appName": "docfx", - "_appFooter": "Supported by the .NET Foundation. Made with docfx" + "_appFooter": "Supported by the .NET Foundation. Made with docfx", + "_googleTagId": "G-Q5N6XJHEX5" }, "output": "_site", "template": [ diff --git a/docs/docs/template.md b/docs/docs/template.md index 5c9dda4977a..dd5db33d538 100644 --- a/docs/docs/template.md +++ b/docs/docs/template.md @@ -41,7 +41,8 @@ Name | Type | Description `_disableNewTab` | bool | Whether to render external link indicator icons and open external links in a new tab. `_disableNextArticle` | bool | Whether to show the previous and next article link. `_disableTocFilter` | bool | Whether to show the table of content filter box. -`lang` | string | Primary language of the page. If unset, the `` tag will not have `lang` property. +`_googleTagId` | string | Enables Google Analytics web traffic analysis. +`lang` | string | Primary language of the page. If unset, the `` tag will not have `lang` property. `layout` | string | Determines the layout of the page. Supported values are `landing` and `chromeless`. # [Default Template](#tab/default) diff --git a/templates/modern/layout/_master.tmpl b/templates/modern/layout/_master.tmpl index 6f963529708..9ab99eb6cd5 100644 --- a/templates/modern/layout/_master.tmpl +++ b/templates/modern/layout/_master.tmpl @@ -39,6 +39,16 @@ {{/redirect_url}} + {{#_googleTagId}} + + + {{/_googleTagId}} + {{^redirect_url}}
From 4a32eb3f8299bcc62becc3d9e869f883ff55afc1 Mon Sep 17 00:00:00 2001 From: yufeih Date: Fri, 5 May 2023 01:47:13 +0000 Subject: [PATCH 2/2] test(snapshot): update snapshots for 3d7f25d5d58aa31b8a93bcd5b381223e0efb6dad --- .../html/api-BuildFromProject.Class1.html.verified.html | 1 + .../html/api-CatLibrary.Cat-2.html-q-cat.verified.html | 1 + .../html/api-CatLibrary.html-term-cat.verified.html | 1 + .../SamplesTest.SeedHtml/html/api-CatLibrary.html.verified.html | 1 + .../html/articles-csharp_coding_standards.html.verified.html | 1 + ...l-tabs-windows-2Ctypescript-markdown-extensions.verified.html | 1 + .../SamplesTest.SeedHtml/html/index.html.verified.html | 1 + .../html/restapi-petstore.html.verified.html | 1 + 8 files changed, 8 insertions(+) diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-BuildFromProject.Class1.html.verified.html b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-BuildFromProject.Class1.html.verified.html index d37b6174df0..b590fdc09fd 100644 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-BuildFromProject.Class1.html.verified.html +++ b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-BuildFromProject.Class1.html.verified.html @@ -205,6 +205,7 @@ } +