eTracker integration

Have more questions? Submit a request

eTracker is a popular alternative for Google Analytics, it has the ability to gather analytical data from your website users while still being GDPR compliant. 


By default you can install eTracker so it does not track any personal data. Using their api we can connect it to the CookieFirst cookie banner so when someone consents to the use of their data we can alter the functions of eTracker to gather this data. 

Add the following script under the eTracker embed code.


// CookieFirst connection with eTracker
const syncEtrackerConsent = (event) => {
  var consent = event ? event.detail || {} : {};

  if(typeof _etracker !== "undefined") {
	  //Default checks for consent for performance, replace it with the category of choice
    if(consent.performance) {
        _etracker.enableCookies('<YOUR DOMAIN>');
    } else if(_etracker.areCookiesEnabled()) {
		console.warn("etracker disable");
        _etracker.disableCookies('<YOUR DOMAIN>');
// listen for Cookie First consent events
window.addEventListener("cf_consent", syncEtrackerConsent);
window.addEventListener("cf_consent_loaded", syncEtrackerConsent);

Articles in this section

Was this article helpful?
1 out of 1 found this helpful