diff --git a/_config.yml b/_config.yml index 84f1be2..77e0b68 100644 --- a/_config.yml +++ b/_config.yml @@ -134,7 +134,7 @@ footer-link-col: "#404040" #gtag: "" # Fill in your Google Analytics ID to track your website using Google Analytics -google_analytics: "UA-125339405-1" +google_analytics: "UA-125339405-1" #MUST ALSO BE UPDATED IN analytics.js # Google Tag Manager ID #gtm: "" diff --git a/_includes/analytics.js b/_includes/analytics.js new file mode 100644 index 0000000..77a7ae2 --- /dev/null +++ b/_includes/analytics.js @@ -0,0 +1,27 @@ +/*This function will load script and call the callback once the script has loaded*/ + +function loadScriptAsync(scriptSrc, callback) { +if (typeof callback !== 'function') { + throw new Error('Not a valid callback for async script load'); +} +var script = document.createElement('script'); +script.onload = callback; +script.src = scriptSrc; +document.head.appendChild(script); } + +/* This is the part where you call the above defined function and "calls back" your code which gets executed after the script has loaded */ + +// loadScriptAsync('https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX', function () { +// window.dataLayer = window.dataLayer || []; +// function gtag() { dataLayer.push(arguments); } +// gtag('js', new Date()); +// gtag('config', 'G-XXXXXXXXXX', { 'anonymize_ip': true }); +// }) + +window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; +ga('create', 'UA-125339405-1', 'auto'); +ga('send', 'pageview'); + +loadScriptAsync(src='https://www.google-analytics.com/analytics.js') + + diff --git a/_includes/cookie-consent.html b/_includes/cookie-consent.html new file mode 100644 index 0000000..2f4b344 --- /dev/null +++ b/_includes/cookie-consent.html @@ -0,0 +1,58 @@ + +