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">
|
||||
|
||||
<head>
|
||||
@@ -17,14 +19,15 @@
|
||||
<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="prism.js"></script>
|
||||
<script>
|
||||
if (window.location.hostname.includes('localhost') === false) {
|
||||
@if (WebHostEnvironment.IsProduction())
|
||||
{
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'G-5JM0TZTRHF');
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
}
|
||||
<script src="_framework/blazor.web.js"></script>
|
||||
</body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user