Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

169
Vistas
Insert script tag in javascript

I used the following javascript function for our cookie consent message on our website. How can I add the Mailchimp code to this? The problem is that Mailchimp needs the <script id="mcjs">

Code I'm using to check if someone allows cookies. If so than activate Google Analytics etc.

function BlockCookie() {
var imported = document.createElement('script');
imported.src = 'https://www.googletagmanager.com/gtag/js?id=ANALYTICS_CODE';
document.head.appendChild(imported);

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'ANALYTICS_CODE', { 'anonymize_ip': true });

window._mfq = window._mfq || [];
  (function() {
    var mf = document.createElement(\"script\");
    mf.type = \"text/javascript\"; mf.defer = true;
    mf.src = \"//cdn.mouseflow.com/projects/cae0bb6e-2421-49b4.js\";
    document.getElementsByTagName(\"head\")[0].appendChild(mf);
  })();
}

Mailchimp code I would like to add to the function

<script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/01ad3420bde595/306da052f4.js");</script>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda