Skip to content

Commit

Permalink
add cookies consent
Browse files Browse the repository at this point in the history
  • Loading branch information
le4ker committed Jan 19, 2024
1 parent bc401df commit f2b2a42
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 33 deletions.
44 changes: 43 additions & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,49 @@
{% endif %} {% if page.url == "/404.html" | prepend: {{site.baseurl}} %}
<meta http-equiv="refresh" content="20; url={{site.baseurl}}/" />
{% endif %} {% include web-app.html %} {% include color-browser.html %} {%
include syntax-highlight.html %}
include syntax-highlight.html %} {% if jekyll.environment == "production" %}
{% if site.google-tracking-id %}

<!-- Cookie Consent by TermsFeed https://www.TermsFeed.com -->
<script
type="text/javascript"
src="https://www.termsfeed.com/public/cookie-consent/4.1.0/cookie-consent.js"
charset="UTF-8"
></script>
<script type="text/javascript" charset="UTF-8">
document.addEventListener("DOMContentLoaded", function () {
cookieconsent.run({
notice_banner_type: "simple",
consent_type: "express",
palette: "light",
language: "en",
page_load_consent_levels: ["strictly-necessary"],
notice_banner_reject_button_hide: false,
preferences_center_close_button_hide: false,
page_refresh_confirmation_buttons: false,
website_name: "{{ site.url }}",
});
});
</script>

<!-- Google Analytics -->

<script
type="text/plain"
data-cookie-consent="tracking"
async
src="https://www.googletagmanager.com/gtag/js?id={{site.google-tracking-id}}"
></script>
<script type="text/plain" data-cookie-consent="tracking">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{site.google-tracking-id}}');
</script>

<!-- Google Analytics -->

{% endif %} {% endif %}
</head>

<!-- HEAD End -->
34 changes: 2 additions & 32 deletions _includes/js.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,38 +67,8 @@
</script>

{% endif %} {% if jekyll.environment == "production" %} {% if
site.google-tracking-id %}

<!-- Google Tracking Id Start -->

<script>
(function (i, s, o, g, r, a, m) {
i["GoogleAnalyticsObject"] = r;
(i[r] =
i[r] ||
function () {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = 1 * new Date());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(
window,
document,
"script",
"//www.google-analytics.com/analytics.js",
"ga",
);
ga("create", "{{ site.google-tracking-id }}", "auto");
ga("send", "pageview");
</script>

<!-- Google Tracking Id End -->

{% endif %} {% endif %} {% if site.disqus-shortname and jekyll.environment ==
"production" %}
site.google-tracking-id %} {% endif %} {% endif %} {% if site.disqus-shortname
and jekyll.environment == "production" %}

<!-- Disqus -->

Expand Down

0 comments on commit f2b2a42

Please sign in to comment.