Updates
Migration Guide for the New API System
4min
in this guide, we’ll explain how to migrate to the new api system, showing you example code the migration must be completed by march 10, 2025 be careful not to use both callback systems simultaneously migration for users with cmp based on tcf below is an example of the previous api system to read the current and/or updated consent var pub tech cmp on consent queue = pub tech cmp on consent queue || \[]; pub tech cmp on consent queue push(function onconsent(consentdata, consentobject, publisherconsentobject) { 	console log(consentdata privacylaw); 	 	if (consentdata privacylaw == 'tcf v2 gdpr') { 	 console log(consentdata, consentobject, publisherconsentobject); 	} }); the structure of the new command is as follows var pubtech queue on consent = pubtech queue on consent || \[]; pubtech queue on consent push(function publisherread(cmptype, data) => { console log("cmp type provided", cmptype); if (cmptype == 'tcf v2 gdpr') { 	 // how to get the old consentdata 	 console log("the old consentdata", data consentbundle); 	 // how to get the old consentobject 	 console log("the old consentobject", data consentbaseapi); 	 // how to get the old publisherconsentobject 	 console log("the old publisherconsentobject", data integrations cookieconsents); 	} }); as you can see, the main difference lies in the structure and available arguments in the callback, which is added to the new global variable all apis from the previous command are accessible through the new command as shown in the example above for further questions, please contact us at support\@pubtech ai mailto\ support\@pubtech ai 😬 please note that to read cookieconsents, it is necessary to configure the cookies you use through the configurator you can use our cookie scanner to help identify and recognize some of the cookies you use; any unrecognized ones must be specified migration for users with cmp based only on google consent mode without tcf var pub tech cmp on consent queue = pub tech cmp on consent queue || \[]; pub tech cmp on consent queue push(function onconsent(consentdata, consentobject) { 	console log(consentdata privacylaw); 	 	if (consentdata privacylaw == 'google consent mode') { 	 console log(consentdata, consentobject); 	} }); the structure of the new command is as follows var pubtech queue on consent = pubtech queue on consent || \[]; pubtech queue on consent push(function publisherread(cmptype, data) => { console log("cmp type provided", cmptype); if (cmptype == 'google consent mode') { 	 // how to get the old consentdata 	 console log("the old consentdata", data consentbundle); 	 // how to get the old consentobject 	 console log("the old consentobject", data consentbaseapi); 	} }); as you can see, the main difference lies in the structure and available arguments in the callback, which is added to the new global variable all apis from the previous command are accessible through the new command as shown in the example above for further questions, please contact us at support\@pubtech ai mailto\ support\@pubtech ai