• Resolved universalmovies

    (@universalmovies)


    Hello,
    I have implemented the Quantcast policy, but in the reader version of AMP it is not displayed. How should I solve this problem? Are there widgets that Automattic AMP also reports in the amp version of the link?

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    How did you implement Quantcast policy for non-AMP? I’m not familiar with that that is.

    • This reply was modified 4 years, 3 months ago by Weston Ruter.
    Thread Starter universalmovies

    (@universalmovies)

    I simply pasted the tag created by Quantcast.com into the body of my theme.

    Non-AMPs get the consent message, AMPs don’t.

    Plugin Author Weston Ruter

    (@westonruter)

    What code did you paste exactly?

    Thread Starter universalmovies

    (@universalmovies)

    So, the code received by Quantcast is the following:

    <!– 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/’, ‘my code’, ‘/’, 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);
    }
    };

    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) –>

    Plugin Author Weston Ruter

    (@westonruter)

    That code will not work in AMP because it involves custom JS which is not allowed in AMP. Any custom such JS is stripped out by the AMP plugin to ensure AMP validity.

    In looking at the Quantcast docs, they say that AMP is not supported for this reason:

    Does Quantcast Choice work with Google AMP?
    We do not support Google AMP at this time. Google AMP pages do not support Javascript which is needed for a CMP with granular user preferences like Choice.

    AMP also does not support the IAB TCF v2.0 at this point, and therefore we recommend you speak to your Google representative to find out the best way to gather consent in AMP pages.

    Thread Starter universalmovies

    (@universalmovies)

    Ah understood.
    What solution do you suggest to integrate the cookie solution into your plug-in?

    Plugin Author Weston Ruter

    (@westonruter)

    For like GDPR consent? There’s this plugin: https://www.ads-software.com/plugins/wp-gdpr-cookie-notice/

    Thread Starter universalmovies

    (@universalmovies)

    I installed the recommended plugin, but at the moment I still don’t see the cookie solution on AMP pages.

    Plugin Author Weston Ruter

    (@westonruter)

    You don’t see consent banners as depicted in that plugin’s screenshots?

    Thread Starter universalmovies

    (@universalmovies)

    Of course I see them, but only in the non-AMP version of the site. You can check if you want one of my AMP pages.
    I followed all the plug-in instructions.

    Plugin Author Weston Ruter

    (@westonruter)

    Sorry, I’m not sure. I see the consent notice on one such site that uses the plugin: https://felix-arntz.me/

    You may need to open a support topic regarding the issue. It could be that the plugin isn’t specifically supporting Reader mode yet.

    Thread Starter universalmovies

    (@universalmovies)

    I also thought that the problem could have been the reader mode, I try to open a support topic on the homepage of the site. Thank you

    Thread Starter universalmovies

    (@universalmovies)

    obviously update you

    Quantcast says that AMP does not support the IAB TCF v2.0, so it seems that you can’t put the Quantcast CMP in AMP pages

    Does Quantcast Choice work with Google AMP?
    https://help.quantcast.com/hc/en-us/articles/360048696153-User-FAQ-for-Quantcast-Choice-on-TCF-v2-0-#h_781aa748-8682-478a-9ebd-4a7cf4e0ee37

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Quantcast’ is closed to new replies.