If you have Tag Commander installed on your site, we propagate Consents into the DataLayer. You just need to call ac_showConsentToolIfNeeded
or ac_acceptAll
with a tcEvents
parameter, which names the Tag Command container to use.
For example,
window.__cmp('ac_acceptAll', {tcEvents: 'tc_events_3'}, function () {})
You can also pass an accessor function which resolves the function to call, like this:
window.__cmp('ac_acceptAll', {tcEvents: function(){return window.tc_events_3}}, function () {})
Will result in the following call:
window.tc_events_3(null, 'chandago_consent_action', {appconsent_ctrl_global_advertising: '1',appconsent_ctrl_global_functional: '0',appconsent_ctrl_usage1: '1',appconsent_ctrl_usage2: '1',appconsent_ctrl_usage3: '1',appconsent_ctrl_usage4: '1',appconsent_ctrl_usage5: '0'})
Notice how the tcEvents
parameter defines which container to use for the call.
*_usage<usageId>
are named after official IAB usages. Values are strings, '1'
for consent given and '0'
for no consent.
The earlier you pass the tcEvents
parameter the better. We strongly encourage this:
window.__cmp('ac_showConsentToolIfNeeded', {tcEvents: 'tc_events_3'}, function () {})