Update Analytics.svelte
moved GTM script into its own const
This commit is contained in:
parent
088f4683e7
commit
fde8f30fb5
1 changed files with 2 additions and 5 deletions
|
|
@ -3,6 +3,7 @@
|
|||
<script module>
|
||||
// GTM configuration
|
||||
const GTM_ID = 'GTM-P9TTSWG2';
|
||||
const GTM_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','${GTM_ID}');`
|
||||
|
||||
import { registerPageview as registerChartbeatPageview } from './providers/chartbeat';
|
||||
import { registerPageview as registerGAPageview } from './providers/ga';
|
||||
|
|
@ -40,11 +41,7 @@
|
|||
|
||||
<svelte:head>
|
||||
<!-- Google Tag Manager -->
|
||||
{@html `<${'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','${GTM_ID}');</script>`}
|
||||
{@html `<${'script'}>${GTM_SCRIPT}</script>`}
|
||||
<!-- End Google Tag Manager -->
|
||||
</svelte:head>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue