- Priority: 0
- Status: Closed
- Theme: Alysum
-
Assigned To:
Fred
- Private: No
- Open Date: 08.02.21, 10:26
- Opened by: Santiago Benitez
- Closed by: Anonymous Submitter
- Closed on:
- Reason: Not a bug
Ticket #20692 - Cookies Change obligation RGPD
Hello,
I need to set a different Cookie setup for the site than the one you bring in the template since is outdated and not valid anymore that kind of cookie banner. I could set it on the normal site, as you can see:
calzadosnebrix.com
This is the script:
// <!-- Quantcast Choice. Consent Manager Tag v2.0 (for TCF 2.0) --> <script type="text/javascript" async=true> (function() { var host = 'calzadosnebrix.com'; var element = document.createElement('script'); var firstScript = document.getElementsByTagName('script')[0]; var url = 'https://quantcast.mgr.consensu.org' .concat('/choice/', 'FXwczbVWrLWmg', '/', 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) --> //
But I can not set the script in the AMP version of the site, could you help me how to set this script for AMP to be able to live my site in Europe please?:
I tried to insert it in at the same time in:
themes/alysum/templates/_partials/header.tpl
than in:
modules/pkamp/views/templates/hook/amp_header.tpl
But i does not work
There is also another version of the script tag for AMP in the site for implementing, but is neither working when I place it on amp_header.tpl or header.tpl itself
is this:
<!-- QUANTCAST CMP --> <amp-consent id="quantcast" layout="nodisplay"> <script type="application/json"> { "consentInstanceId": "quantcast", "checkConsentHref": "https://apis.quantcast.mgr.consensu.org/amp/check-consent", "consentRequired": "remote", "promptUISrc": "https://quantcast.mgr.consensu.org/tcfv2/amp.html", "clientConfig": { "coreUiLabels": {}, "theme": {}, "coreConfig": { "quantcastAccountId": "FXwczbVWrLWmg", "privacyMode": [ "GDPR" ], "hashCode": "gtln98NoyG5QhTXbGs0grw", "publisherCountryCode": "ES", "vendorPurposeIds": [ 2, 3, 4, 5, 6, 7, 8, 9, 10, 1 ], "vendorFeaturesIds": [ 1, 3, 2 ], "vendorPurposeLegitimateInterestIds": [ 2, 3, 4, 5, 6, 7, 8, 9, 10 ], "vendorSpecialFeaturesIds": [ 1, 2 ], "vendorSpecialPurposesIds": [ 1, 2 ], "googleEnabled": false, "lang_": "es", "displayUi": "always", "defaultToggleValue": "off", "initScreenRejectButtonShowing": true, "publisherConsentRestrictionIds": [], "publisherLIRestrictionIds": [], "publisherPurposeIds": [], "publisherPurposeLegitimateInterestIds": [], "publisherSpecialPurposesIds": [], "publisherFeaturesIds": [], "publisherSpecialFeaturesIds": [], "stacks": [], "vendorListUpdateFreq": 30 } } } </script> </amp-consent> <!--END QUANTCAST CMP -->
Please provide some help
Thank you
Comments
Hi, Santiago.
AMP doesn’t allow third party JS code. If you add it you will make your page invalid. Is it ok for you?
And what do you mean by “not working”? do you have a white page? if so, you have to use “{literal} CODE {literal}” tags like this