We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The stub example is incorrect (the function __gpp_stub still returns the values instead of calling the callback).
Corrected function:
window.__gpp_stub = function () { var b = arguments; __gpp.queue = __gpp.queue || []; if (!b.length) { return __gpp.queue; } var cmd = b[0]; var clb = b.length > 1 ? b[1] : null; var par = b.length > 2 ? b[2] : null; var result = null; if (cmd === 'ping') { result = { gppVersion: '1.1', // must be “Version.Subversion”, current: “1.1” cmpStatus: 'stub', // possible values: stub, loading, loaded, error cmpDisplayStatus: 'hidden', // possible values: hidden, visible, disabled supportedAPIs: ['2:tcfeuv2', '5:tcfcav1', '6:uspv1'], // list of supported APIs signalStatus : 'not ready', cmpId: 31, // IAB assigned CMP ID, may be 0 during stub/loading sectionList: [], applicableSections: [-1], //or 0 or ID set by publisher gppString: '' }; } else if (cmd === 'addEventListener') { __gpp.events = __gpp.events || []; if (!('lastId' in __gpp)) { __gpp.lastId = 0; } __gpp.lastId++; var lnr = __gpp.lastId; __gpp.events.push({ 'id': lnr, 'callback': clb, 'parameter': par }); result = { eventName: 'listenerRegistered', listenerId: lnr, // Registered ID of the listener data: true, // positive signal pingData: { gppVersion: '1.1', cmpStatus: 'stub', signalStatus : 'not ready', cmpDisplayStatus: 'hidden', supportedAPIs: ['2:tcfeuv2', '5:tcfcav1', '9:usva', '7:usnat'], cmpId: 31, sectionList: [], applicableSections: [-1], //or 0 or ID set by publisher gppString: '' } }; } else if (cmd === 'removeEventListener') { var success = false; __gpp.events = __gpp.events || []; for (var i = 0; i < __gpp.events.length; i++) { if (__gpp.events[i].id == par) { __gpp.events[i].splice(i, 1); success = true; break; } } result = { eventName: 'listenerRemoved', listenerId: par, // Registered ID of the listener data: success, // status info pingData: { gppVersion: '1.1', cmpStatus: 'stub', signalStatus : 'not ready', cmpDisplayStatus: 'hidden', supportedAPIs: ['2:tcfeuv2', '5:tcfcav1', '9:usva', '7:usnat'], cmpId: 31, sectionList: [], applicableSections: [-1], //or 0 or ID set by publisher gppString: '' } }; } //queue all other commands else { __gpp.queue.push([].slice.apply(b)); } if(result !== null && typeof(clb) === 'function') { clb(result, true); } };
The text was updated successfully, but these errors were encountered:
@janwinkler do you mind opening a PR to correct this?
Sorry, something went wrong.
No branches or pull requests
The stub example is incorrect (the function __gpp_stub still returns the values instead of calling the callback).
Corrected function:
The text was updated successfully, but these errors were encountered: