Verified Commit b56040bc authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

fix loading vars from config

parent e956f5b9
......@@ -19,6 +19,12 @@
{%- include css-imports.html -%}
{% if site.siteID > 0 %}
<script>
var settings = [];
settings.expires = "{{ site.cookies_expire }}";
settings.matomoURL = "{{ site.analyticsurl }}";
settings.siteID = "{{ site.siteID }}";
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js"></script>
<script src="{{ '/assets/js/gdpr.js' | relative_url }}"></script>
......
/* Matomo global variable
note: most code has been inspired from:
https://edps.europa.eu/sites/edp/modules/features/edpsweb_cookies/js/cookies-popup.js
*/
var _paq = window._paq || _paq || [];
var settings = [];
settings.expires = "{{ site.cookies_expire }}";
settings.matomoURL = "{{ site.analyticsurl }}";
settings.siteID = "{{ site.siteID }}";
/*
getCookie: retrieve a cookie that has been set.
inspired from https://www.w3schools.com/js/js_cookies.asp
*/
......@@ -31,6 +24,7 @@ function getCookie(cname) {
/* loadMatomo: load the tracking code of the matomo instance */
function loadMatomo() {
if (settings.siteID > 0) {
var _paq = window._paq || _paq || [];
var u = settings.matomoURL;
_paq.push(['setSiteId', settings.siteID]);
_paq.push(['setTrackerUrl', u + 'matomo.php']);
......@@ -58,7 +52,6 @@ function showCookieBanner() {
function hideCookieBanner() {
var popup = jQuery('#lap-cookies-banner');
popup.hide();
console.log('removed the banner');
}
/* clearCookies: clear all cookies */
......@@ -73,7 +66,6 @@ function clearCookies() {
}
$( document ).ready(function() {
/* accept */
$('.lap-cookies-accept').click(function (e) {
e.preventDefault(true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment