Cookie Zendesk
You only have a Zendesk cookie and you don't want to use Google Tag Manager to install it.

1. Zendesk cookie integration in custom mode

A - Locate it on your website

Here is the code that launches the Zendesk chat that you should have in your site Header
1
<script type="application/javascript" src="'https://static.zdassets.com/ekr/snippet.js?key=4e15810f-956f-40d6-bcab-59f8768b80c1"/>
Copied!

B - The Zendesk function

We'll now transform the script and encapsulate it in a function that will launch the script (the launchZendesk() function).
1
function launchZendesk(){
2
var el = document.createElement('script');
3
el.setAttribute('src', 'https://static.zdassets.com/ekr/snippet.js?key=4e15810f-956f-40d6-bcab-59f8768b80c1');
4
el.id = "ze-snippet";
5
document.head.append(el);
6
}
Copied!

C - Integration on your website

You'll just have to add the code
1
<script type="text/javascript">
2
//Le sdk qui permet de lancer le widget Axeptio et de sauvegarder les acceptations
3
var el = document.createElement('script');
4
el.setAttribute('src', 'https://static.axept.io/sdk.js');
5
el.setAttribute('type', 'text/javascript');
6
el.setAttribute('async', true);
7
el.setAttribute('data-id', '5xxXXxxXXXxxXXXxxXXXa');
8
el.setAttribute('data-cookies-version', 'XXXXX');
9
if (document.body !== null) {
10
document.body.appendChild(el);
11
}
12
13
// La fonction qui permet de lancer Zendesk
14
function launchZendesk(){
15
var el = document.createElement('script');
16
el.setAttribute('src', 'https://static.zdassets.com/ekr/snippet.js?key=4e15810f-956f-40d6-bcab-59f8768b80c1');
17
el.id = "ze-snippet";
18
document.head.append(el);
19
}
20
21
// La fonction qui relie Axeptio au lancement du cookie Zendesk
22
void 0 === window._axcb && (window._axcb = []);
23
window._axcb.push(function(axeptio) {
24
axeptio.on("cookies:complete", function(choices) {
25
if(choices.zendesk) {
26
launchZendesk();
27
}
28
});
29
});
30
</script>
Copied!
Great ! Everything works 👌