diff --git a/_config.yml b/_config.yml index d4b7d9fa9..1a7d00bc2 100644 --- a/_config.yml +++ b/_config.yml @@ -5,8 +5,10 @@ description: > # this means to ignore newlines until "baseurl:" Bioschemas relies and extends from schema.org and aims to reuse existing standards and reach consensus among a wide number of life sciences organizations and communities. url: "http://bioschemas.org" # the base hostname & protocol for your site +baseurl: "" # the subpath of your site, e.g. /blog/ twitter_username: Bioschemas github_username: Bioschemas +google_analytics: G-G3BQK7PF1V # Build settings markdown: kramdown diff --git a/_includes/cookie-consent.html b/_includes/cookie-consent.html new file mode 100644 index 000000000..6f05395f7 --- /dev/null +++ b/_includes/cookie-consent.html @@ -0,0 +1,59 @@ + +
+ diff --git a/_includes/ga.js b/_includes/ga.js new file mode 100644 index 000000000..b2a62accf --- /dev/null +++ b/_includes/ga.js @@ -0,0 +1,17 @@ +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); +} + +loadScriptAsync('https://www.googletagmanager.com/gtag/js?id=G-G3BQK7PF1V', function () { + window.dataLayer = window.dataLayer || []; + function gtag() { dataLayer.push(arguments); } + gtag('js', new Date()); + gtag('config', 'G-G3BQK7PF1V', { 'anonymize_ip': true }); + console.log('Google Analytics is active'); +}) diff --git a/_includes/head.html b/_includes/head.html index ac50c911e..4dcf67e87 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -35,6 +35,4 @@ - - {% include analytics.html %} diff --git a/_layouts/default.html b/_layouts/default.html index 00130b1f5..fffec0b14 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -11,5 +11,6 @@ {% include footer.html %} + {% include cookie-consent.html %}