From c37dd44b2a525264e7b42a140fe7a4e0d90ffafa Mon Sep 17 00:00:00 2001 From: Jean-Michel Frouin Date: Mon, 26 Jul 2021 14:32:05 +0200 Subject: [PATCH] [Evol/#745] Service Marketo --- tarteaucitron.services.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 24892d8..f326a92 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -4369,3 +4369,37 @@ tarteaucitron.services.bandcamp = { }); } }; + +// Marketo munchkin +tarteaucitron.services.marketomunchkin = { + "key": "marketomunchkin", + "type": "api", + "name": "Marketo munchkin", + "uri": "https://documents.marketo.com/legal/cookies", + "needConsent": true, + "cookies": ['OptAnon', '_mkto_trk'], + "js": function () { + "use strict"; + if (tarteaucitron.user.marketomunchkinkey === undefined) { + return; + } + var didInit = false; + function initMunchkin() { + if(didInit === false) { + didInit = true; + Munchkin.init(tarteaucitron.user.marketomunchkinkey); + } + } + var s = document.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.src = '//munchkin.marketo.net/munchkin.js'; + s.onreadystatechange = function() { + if (this.readyState == 'complete' || this.readyState == 'loaded') { + initMunchkin(); + } + }; + s.onload = initMunchkin; + document.getElementsByTagName('head')[0].appendChild(s); + } +};