Based on our conversation, it might be helpful to reduce the amount of users asking for help with integration of cookie policy together with MessengerPeople chat, to add this to FAQs in some form.
In combination with third party tools for managing cookies the initialization of the chat script should happen in specific way.
Most tools are working in the way that by default all <script> tags should be marked as “text/plain” and then when user allows then corresponding scripts are changed to “text/javascript”.
When that happens our script is not initialized and for that there is an important part of the code needs to be executed – “window.mpWebchatInit();”. It has to be executed in the right moment of time,
so usually documentation of third-party cookie management tool consists of information on how to do it. The following example shows how to initialize(it mostly depends on the implementation
and could be different in each case) our script in combination with Usecentrics script.
The following code is working sample, it might potentially be presented as example:
<script type=”text/plain” data-usercentrics=”MessengerPeople”>
function loadScript(src, callback)
{
var s,
r,
t;
r = false;
s = document.createElement(‘script’);
s.type = ‘text/javascript’;
s.src = src;
s.setAttribute(“data-id”, “XXXXXXX.XXXXXXXX”);
s.setAttribute(“data-widget”, “mpWidget”);
s.onload = s.onreadystatechange = function() {
if ( !r && (!this.readyState || this.readyState == ‘complete’) )
{
r = true;
callback();
}
};
t = document.getElementsByTagName(‘script’)[0];
document.body.append(s);
}
function initMCP() {
window.mpWebchatInit();
}
loadScript(‘https://cdn.messengerpeople.com/livechat.js‘, initMCP);
</script>
<script
id=”usercentrics-cmp”
data-settings-id=”XXXXXXXXX”
src=https://app.usercentrics.eu/browser-ui/latest/loader.js
defer
></script>