Consent Banner

Posted in: Newspaper
Post count: 8

Translated with Google:

I would like to add a consent banner to the newspaper theme. I wanted to add this code under analytics / Java Script Code Box:

<! – Quantcast Choice. Consent Manager Tag v2.0 (for TCF 2.0) ->
<script type = “text / javascript” async = “true”>
(function () {
var host = window.location.hostname;
var element = document.createElement (‘script’);
var firstScript = document.getElementsByTagName (‘script’) [0];
var url = ‘https://quantcast.mgr.consensu.org&#8217;
.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 {
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);
}
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);
}
};

if (typeof module! == ‘undefined’) {
module.exports = makeStub;
} else {
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 …….
Unfortunately, the Newspaper Theme then no longer saves and there is an endless loading loop.
Are there still any with the problem?

Post count: 35449

Hi,

So if I understand correctly, the theme is no longer saving the settings for you and is in a continue loop when you are trying to save some settings in theme panel.
Usually this issue is related to a firewall or security module which blocks admin-ajax.php request. Please verify the console for error while saving the settings on the Theme Panel, usually it displays a 403 or 404 error.
If you don’t use a security plugin, please ask your host about this, maybe you have a security module which blocks this.
If you use a plugin like Wordfence please set it in learning mode.
Also make sure that you do not have a plugin conflict, please deactivate ALL plugins except tagDiv plugins, also if you are using child theme or cache plugin, deactivate them, clear all cache and try again.

Hope this will help you!
Let me know the results!

Post count: 23

Hi Calin,
Can you please tell me if you plan to build a complete consent banner for Newspaper (Privacy/Cookie) plugin that supports all GDPR features approved by IAB Europe’s CMP Compliance Program, including TCF v2.0. On the internet there are some solutions, but for a fee. And they also cost a lot
Thank you

  • This reply was modified 3 years by eddycom.
Post count: 27744

Hello,

No, you can try to use a plugin for this.
Unfortunately, because they differ from one country to another, and there are many things that must be consoled so that everything is legal.

Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.