Skip to content

Commit

Permalink
Only output trackers on production
Browse files Browse the repository at this point in the history
  • Loading branch information
robdekort committed Oct 26, 2020
1 parent 08cbe56 commit 6580ad9
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions resources/views/snippets/_seo.antlers.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,36 +105,38 @@
{{ /if }}
{{# Trackers #}}
{{ if seo:use_google_tag_manager }}
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{ seo:google_tag_manager }}');</script>
{{ /if }}
{{ if environment == 'production' }}
{{ if seo:use_google_tag_manager }}
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{ seo:google_tag_manager }}');</script>
{{ /if }}
{{ if seo:use_google_tag_manager }}
{{# Yield this section in all your layouts after opening the <body> #}}
{{ section:google_tag_manager }}
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ seo:google_tag_manager }}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
{{ /section:google_tag_manager }}
{{ /if }}
{{ if seo:use_google_tag_manager }}
{{# Yield this section in all your layouts after opening the <body> #}}
{{ section:google_tag_manager }}
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ seo:google_tag_manager }}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
{{ /section:google_tag_manager }}
{{ /if }}
{{ if seo:use_google_site_verification }}
<meta name="google-site-verification" content="{{ seo:google_site_verification }}" />
{{ /if }}
{{ if seo:use_google_site_verification }}
<meta name="google-site-verification" content="{{ seo:google_site_verification }}" />
{{ /if }}
{{ if seo:use_google_analytics }}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ seo:google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('set', new Date());
gtag('config', '{{ seo:google_analytics }}' {{ if seo:anonymize_ip }}, {'anonymize_ip': true}{{ /if }});
</script>
{{ /if }}
{{ if seo:use_google_analytics }}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ seo:google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('set', new Date());
gtag('config', '{{ seo:google_analytics }}' {{ if seo:anonymize_ip }}, {'anonymize_ip': true}{{ /if }});
</script>
{{ /if }}
{{ if seo:use_fathom }}
<script src="https://cdn.usefathom.com/script.js" site="{{ seo:fathom }}" defer></script>
{{ /if }}
{{ if seo:use_fathom }}
<script src="https://cdn.usefathom.com/script.js" site="{{ seo:fathom }}" defer></script>
{{ /if }}
{{ /if }}

0 comments on commit 6580ad9

Please sign in to comment.