fix: use web host env to decide whether to render google tag script
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
@inject IWebHostEnvironment WebHostEnvironment
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
@@ -17,14 +19,15 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js"></script>
|
||||||
<script src="https://www.googletagmanager.com/gtag/js?id=G-5JM0TZTRHF"></script>
|
<script src="https://www.googletagmanager.com/gtag/js?id=G-5JM0TZTRHF"></script>
|
||||||
<script src="prism.js"></script>
|
<script src="prism.js"></script>
|
||||||
<script>
|
@if (WebHostEnvironment.IsProduction())
|
||||||
if (window.location.hostname.includes('localhost') === false) {
|
{
|
||||||
|
<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', 'G-5JM0TZTRHF');
|
gtag('config', 'G-5JM0TZTRHF');
|
||||||
}
|
</script>
|
||||||
</script>
|
}
|
||||||
<script src="_framework/blazor.web.js"></script>
|
<script src="_framework/blazor.web.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user