File tree Expand file tree Collapse file tree 1 file changed +1
-26
lines changed Expand file tree Collapse file tree 1 file changed +1
-26
lines changed Original file line number Diff line number Diff line change 44 PUBLIC_SITE_URL ,
55 PUBLIC_GITHUB_USERNAME ,
66 PUBLIC_LINKED_IN_USERNAME ,
7- PUBLIC_FIVERR_USERNAME ,
8- PUBLIC_GOOGLE_ANALYTICS_ID
7+ PUBLIC_FIVERR_USERNAME
98 } from ' $env/static/public' ;
10- import { onMount } from ' svelte' ;
11-
12- const gaId = PUBLIC_GOOGLE_ANALYTICS_ID ;
13-
14- // Google Analytics
15- onMount (() => {
16- if (! gaId ) return ;
17-
18- // Load GA script
19- const script1 = document .createElement (' script' );
20- script1 .setAttribute (' async' , ' ' );
21- script1 .src = ` https://www.googletagmanager.com/gtag/js?id=${gaId } ` ;
22- document .head .appendChild (script1 );
23-
24- // Init GA
25- const script2 = document .createElement (' script' );
26- script2 .innerHTML = `
27- window.dataLayer = window.dataLayer || [];
28- function gtag(){dataLayer.push(arguments);}
29- gtag('js', new Date());
30- gtag('config', '${gaId }');
31- ` ;
32- document .head .appendChild (script2 );
33- });
349 </script >
3510
3611<svelte:head >
You can’t perform that action at this time.
0 commit comments