Como reduzir o tamanho da janela pop-up do CMP

  • Autor Autor bueumoma
  • Data de início Data de início
Tradução em andamento: em alguns minutos este tópico estará em português. Por enquanto, o conteúdo está no original em espanhol. Ver original
bueumoma

bueumoma

Gamma
Usuário com poucas negociações! Use sempre o saldo do ForoBeta!
Hola a todos:
Este es el script:
<!-- Quantcast Choice. Consent Manager Tag v2.0 (for TCF 2.0) -->
<script type="text/javascript" async=true>
(function() {
var host = 'www.themoneytizer.com';
var element = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
var url = 'https://cmp.quantcast.com'
.concat('/choice/', '6Fv0cGNfc_bw8', '/', host, '/choice.js');
var uspTries = 0;
var uspTriesLimit = 3;
element.async = true;
element.type = 'text/javascript';
element.src = url;

firstScript.parentNode.insertBefore(element, firstScript);

function makeStub() {
var TCF_LOCATOR_NAME = '__tcfapiLocator';
var queue = [];
var win = window;
var cmpFrame;

function addFrame() {
var doc = win.document;
var otherCMP = !!(win.frames[TCF_LOCATOR_NAME]);

if (!otherCMP) {
if (doc.body) {
var iframe = doc.createElement('iframe');

iframe.style.cssText = 'display:none';
iframe.name = TCF_LOCATOR_NAME;
doc.body.appendChild(iframe);
} else {
setTimeout(addFrame, 5);
}
}
return !otherCMP;
}

function tcfAPIHandler() {
var gdprApplies;
var args = arguments;

if (!args.length) {
return queue;
} else if (args[0] === 'setGdprApplies') {
if (
args.length > 3 &&
args[2] === 2 &&
typeof args[3] === 'boolean'
) {
gdprApplies = args[3];
if (typeof args[2] === 'function') {
args[2]('set', true);
}
}
} else if (args[0] === 'ping') {
var retr = {
gdprApplies: gdprApplies,
cmpLoaded: false,
cmpStatus: 'stub'
};

if (typeof args[2] === 'function') {
args[2](retr);
}
} else {
if(args[0] === 'init' && typeof args[3] === 'object') {
args[3] = { ...args[3], tag_version: 'V2' };
}
queue.push(args);
}
}

function postMessageEventHandler(event) {
var msgIsString = typeof event.data === 'string';
var json = {};

try {
if (msgIsString) {
json = JSON.parse(event.data);
} else {
json = event.data;
}
} catch (ignore) {}

var payload = json.__tcfapiCall;

if (payload) {
window.__tcfapi(
payload.command,
payload.version,
function(retValue, success) {
var returnMsg = {
__tcfapiReturn: {
returnValue: retValue,
success: success,
callId: payload.callId
}
};
if (msgIsString) {
returnMsg = JSON.stringify(returnMsg);
}
if (event && event.source && event.source.postMessage) {
event.source.postMessage(returnMsg, '*');
}
},
payload.parameter
);
}
}

while (win) {
try {
if (win.frames[TCF_LOCATOR_NAME]) {
cmpFrame = win;
break;
}
} catch (ignore) {}

if (win === window.top) {
break;
}
win = win.parent;
}
if (!cmpFrame) {
addFrame();
win.__tcfapi = tcfAPIHandler;
win.addEventListener('message', postMessageEventHandler, false);
}
};

makeStub();

var uspStubFunction = function() {
var arg = arguments;
if (typeof window.__uspapi !== uspStubFunction) {
setTimeout(function() {
if (typeof window.__uspapi !== 'undefined') {
window.__uspapi.apply(window.__uspapi, arg);
}
}, 500);
}
};

var checkIfUspIsReady = function() {
uspTries++;
if (window.__uspapi === uspStubFunction && uspTries < uspTriesLimit) {
console.warn('USP is not accessible');
} else {
clearInterval(uspInterval);
}
};

if (typeof window.__uspapi === 'undefined') {
window.__uspapi = uspStubFunction;
var uspInterval = setInterval(checkIfUspIsReady, 6000);
}
})();
</script>
<!-- End Quantcast Choice. Consent Manager Tag v2.0 (for TCF 2.0) -->

Me gustaría reducir el tamaño de la ventana, ya que ocupa todo lo ancho de la web, y en formato smartphone, ocupa toda la pantalla.

Usando la inteligencia artificial, me ha aconsejado el siguiente código, pero no funciona.

<style>
/* Cambiar el tamaño de la ventana emergente del CMP */
iframe[src*="cmp.quantcast.com"] {
width: 300px !important;
height: 250px !important;
}
</style>

He cambiado los parámetros, pero no hace, ni lo reduce ni nada. El código lo he puesto en varios lugares, y tampoco ha cambiado el tamaño. Y si fuera posible, me gustaría que en lugar de aparecer en la parte inferior, apareciera más o menos en el centro.

Adjunto captura de pantalla.



Un saludo y gracias por las posible soluciones.
 

Anexos

  • Captura de Pantalla 2023-07-19 a las 20.39.27.webp
    Captura de Pantalla 2023-07-19 a las 20.39.27.webp
    150,8 KB · Visitas: 71
Foi útil? Participe da conversa

Com sua conta grátis você pode responder, mandar mensagem privada ao autor e comprar com Saldo retido: o pagamento é liberado quando você recebe o combinado.

Leva 30 segundos · você volta a este tópico ao terminar
Segun chatbot... Agregando esta parte en lugar de iframe[src*="cmp.quantcast.com"] { ..
JavaScript:
function addFrame() {
 var doc = win.document;
 var otherCMP = !!(win.frames[TCF_LOCATOR_NAME]);

 if (!otherCMP) {
   if (doc.body) {
     var iframe = doc.createElement('iframe');

     iframe.style.cssText = 'display:none; width:300px; height:250px;'; // Aquí agregas el ancho y altura
     iframe.name = TCF_LOCATOR_NAME;
     doc.body.appendChild(iframe);
   } else {
     setTimeout(addFrame, 5);
   }
 }
 return !otherCMP;
}
 
Trata de mirar en el inspector de elementos que clases esta afectando la ventana y que medidas esta agarrando para que puedas sobreescribirlas correctamente con CSS
 
Segun chatbot... Agregando esta parte en lugar de iframe[src*="cmp.quantcast.com"] { ..
JavaScript:
function addFrame() {
 var doc = win.document;
 var otherCMP = !!(win.frames[TCF_LOCATOR_NAME]);

 if (!otherCMP) {
   if (doc.body) {
     var iframe = doc.createElement('iframe');

     iframe.style.cssText = 'display:none; width:300px; height:250px;'; // Aquí agregas el ancho y altura
     iframe.name = TCF_LOCATOR_NAME;
     doc.body.appendChild(iframe);
   } else {
     setTimeout(addFrame, 5);
   }
 }
 return !otherCMP;
}

Gracias por tu respuesta, pero no ha funcionado.
 
Trata de mirar en el inspector de elementos que clases esta afectando la ventana y que medidas esta agarrando para que puedas sobreescribirlas correctamente con CSS
Gracias por tu respuesta. Al no tener conocimientos de CSS, PHP, etc, no sé como se hace.
 
Hola ten en cuenta que la ventana emergente no es solo la cajita pequeña, es todo el bloque que tapa todo el contenido.

1689961849358.png
 
¿alguna pagina donde salga esa publicidad?
 
No es publicidad es un CMP, es el banner de consentimiento de cookies, etc.
Pongo la página oficial del CMP: https://www.quantcast.com ya que me gustaría que quedara igual que la tienen ellos.
 
Voltar
Topo