From dbb120fc66b798fa4225f3afc9fc1cfc636ccac7 Mon Sep 17 00:00:00 2001 From: Ricci Dorian Date: Thu, 26 Jul 2018 10:51:21 +0200 Subject: [PATCH 1/2] Added Hotjar service --- tarteaucitron.services.js | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index de910e4..4b2340e 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -2273,3 +2273,47 @@ tarteaucitron.services.matomo = { tarteaucitron.addScript(tarteaucitron.user.matomoHost + 'piwik.js', '', '', true, 'defer', true); } }; + +// Hotjar + +/* + 1. Set the following variable before the initialization : + + tarteaucitron.user.hotjarId = YOUR_WEBSITE_ID; + tarteaucitron.user.HotjarSv = XXXX; // Can be found in your website tracking code as "hjvs=XXXX" + + 2. Push the service : + + (tarteaucitron.job = tarteaucitron.job || []).push('hotjar'); + + 3. HTML + You don't need to add any html code, if the service is autorized, the javascript is added. otherwise no. + + + */ +tarteaucitron.services.hotjar = { + "key": "hotjar", + "type": "analytic", + "name": "Hotjar", + "uri": "https://help.hotjar.com/hc/en-us/sections/115003204947-What-is-Hotjar-", + "needConsent": true, + "cookies": [], + "js": function () { + "use strict"; + if (tarteaucitron.user.hotjarId === undefined || tarteaucitron.user.HotjarSv === undefined) { + return; + } + + window.hj = window.hj || function() { + (window.hj.q = window.hj.q || []).push(arguments) + }; + window._hjSettings = { + hjid: tarteaucitron.user.hotjarId, + hjsv: tarteaucitron.user.HotjarSv + }; + + var uri = 'https://static.hotjar.com/c/hotjar-'; + var extension = '.js?sv='; + tarteaucitron.addScript(uri + window._hjSettings.hjid + extension + window._hjSettings.hjsv); + } +}; From 0b7eb47dc947bd75d849e0358d31bd6395dfd375 Mon Sep 17 00:00:00 2001 From: Ricci Dorian Date: Wed, 8 Aug 2018 11:30:09 +0200 Subject: [PATCH 2/2] Added list of cookies --- tarteaucitron.services.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 4b2340e..b46d69b 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -2295,9 +2295,9 @@ tarteaucitron.services.hotjar = { "key": "hotjar", "type": "analytic", "name": "Hotjar", - "uri": "https://help.hotjar.com/hc/en-us/sections/115003204947-What-is-Hotjar-", + "uri": "https://help.hotjar.com/hc/en-us/categories/115001323967-About-Hotjar", "needConsent": true, - "cookies": [], + "cookies": ["hjClosedSurveyInvites", "_hjDonePolls", "_hjMinimizedPolls", "_hjDoneTestersWidgets", "_hjMinimizedTestersWidgets", "_hjDoneSurveys", "_hjIncludedInSample", "_hjShownFeedbackMessage"], "js": function () { "use strict"; if (tarteaucitron.user.hotjarId === undefined || tarteaucitron.user.HotjarSv === undefined) {