forked from CCCHH/hacker.tours-website
Initial version
This commit is contained in:
commit
ed5653a7fc
211 changed files with 11043 additions and 0 deletions
34
themes/zen/assets/js/tracking.js
Normal file
34
themes/zen/assets/js/tracking.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* @file
|
||||
* A JavaScript file for analytic tracking.
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
import * as params from '@params';
|
||||
/* eslint-enable */
|
||||
|
||||
/* eslint-disable no-undef */
|
||||
const cookiebanner = params.cookieConsent;
|
||||
const cookieconsent = localStorage.getItem('cookieconsent');
|
||||
const idSite = params.piwikSiteID;
|
||||
const matomoTrackingApiUrl = 'https://' + params.piwikTrackerUrl + '/matomo.php';
|
||||
const googleAnalytics = params.GoogleAnalytics;
|
||||
|
||||
if (idSite) {
|
||||
let _paq = window._paq = window._paq || [];
|
||||
|
||||
if (cookiebanner) {
|
||||
_paq.push(['requireConsent']);
|
||||
}
|
||||
_paq.push(['setTrackerUrl', matomoTrackingApiUrl]);
|
||||
_paq.push(['setSiteId', idSite]);
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
if (cookiebanner && cookieconsent === 'accept') {
|
||||
_paq.push(['setConsentGiven']);
|
||||
}
|
||||
}
|
||||
|
||||
if (googleAnalytics && cookiebanner && cookieconsent === 'decline') {
|
||||
window['ga-disable-' + googleAnalytics] = true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue