Added Hotjar service

This commit is contained in:
Ricci Dorian 2018-07-26 10:51:21 +02:00
parent 249a00dd7e
commit dbb120fc66
1 changed files with 44 additions and 0 deletions

View File

@ -2273,3 +2273,47 @@ tarteaucitron.services.matomo = {
tarteaucitron.addScript(tarteaucitron.user.matomoHost + 'piwik.js', '', '', true, 'defer', true); 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);
}
};