Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable google analytics with _googleAnalyticsTagId #8733

Merged
merged 2 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"globalMetadata": {
"_appTitle": "docfx",
"_appName": "docfx",
"_appFooter": "<span>Supported by the <a href=\"https://dotnetfoundation.org\">.NET Foundation</a>. Made with <a href=\"https://dotnet.github.io/docfx\">docfx</a></span>"
"_appFooter": "<span>Supported by the <a href=\"https://dotnetfoundation.org\">.NET Foundation</a>. Made with <a href=\"https://dotnet.github.io/docfx\">docfx</a></span>",
"_googleTagId": "G-Q5N6XJHEX5"
},
"output": "_site",
"template": [
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<html>` tag will not have `lang` property.
`_googleTagId` | string | Enables Google Analytics web traffic analysis.
`lang` | string | Primary language of the page. If unset, the `<html>` tag will not have `lang` property.
`layout` | string | Determines the layout of the page. Supported values are `landing` and `chromeless`.

# [Default Template](#tab/default)
Expand Down
10 changes: 10 additions & 0 deletions templates/modern/layout/_master.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@
{{/redirect_url}}
</head>

{{#_googleTagId}}
<script async src="https://www.googletagmanager.com/gtag/js?id={{_googleTagId}}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '{{_googleTagId}}');
</script>
{{/_googleTagId}}

{{^redirect_url}}
<body class="tex2jax_ignore" data-layout="{{layout}}" data-yaml-mime="{{yamlmime}}">
<header class="bg-body border-bottom">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
}
</style></head>


<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
}
</style></head>


<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
}
</style></head>


<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference" data-search="true">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
}
</style></head>


<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
}
</style></head>


<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
}
</style></head>


<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
}
</style></head>


<body class="tex2jax_ignore" data-layout="landing" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
}
</style></head>


<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
Expand Down