Skip to content

Instantly share code, notes, and snippets.

View nedimdragic's full-sized avatar

Nedim Dragic nedimdragic

  • Tealium
  • Düsseldorf, Germany
View GitHub Profile
;(function(u){
/**
* @desc Map your OneTrust tag IDs here to Tealium Template IDs found in utag.loader.cfg object like this:
* @param "OneTrust_tag_id": "Tealium_tid",
* @return You can add more lines to suit your tag library in both tools
*/
// Begin Config
var oneTrustTagIdToTealiumTemplateIdConfig = {
"81878": "7110", // e.g.: Google Analytics
var a,c;"undefined"==typeof Optanon&&(Optanon=OneTrust={});
(function(){function T(){var b=t();return b.ConsentModel&&b.ConsentModel.Name.toLowerCase()===U.IMPLIEDCONSENT}function V(b){var e=[];for(b=0;b<w.length;b++)ab(w[b],":1")&&wa(w[b].replace(":1",""))&&e.push(w[b].replace(":1",""));b=","+e.toString().toLowerCase()+",";window.OnetrustActiveGroups=b;window.OptanonActiveGroups=b;"undefined"!=typeof dataLayer?dataLayer.constructor===Array&&(dataLayer.push({OnetrustActiveGroups:b}),dataLayer.push({OptanonActiveGroups:b})):window.dataLayer=[{event:"OneTrustLoaded",
OnetrustActiveGroups:b},{event:"OptanonLoaded",OptanonActiveGroups:b}];setTimeout(function(){var b=new CustomEvent("consent.onetrust",{detail:e});window.dispatchEvent(b)})}function bb(){var b=W("https://optanon.blob.core.windows.net/skins/4.9.0/default_flat_bottom_two_button_black/v2/css/optanon.css"),e=document.createElement("link");e.type="text/css";e.href=b;e.rel="stylesheet";document.getElementsByTagName("head")[0].appendChild(e);b=document.que
@nedimdragic
nedimdragic / oneTrustIntegrartion.js
Created May 28, 2019 07:06
Tealium Consent Manager - OneTrust Cookie Consent Manager Integration
;(function(u){
var addListener = function(element, event, callback) {
if(element.addEventListener) {
element.addEventListener(event, callback, false);
}
else if(element.attachEvent) {
element.attachEvent('on' + event, callback);
}
};
var readDataAndSetConsentPref = function(data){