function getParams() {
   var vars = [], hash;
   var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
   for(var i = 0; i < hashes.length; i++) {
      hash = hashes[i].split('=');
      if (hash[0] && hash[1]) {
        vars.push(hash[0].toUpperCase());
        vars[hash[0].toUpperCase()] = hash[1].toUpperCase();
      }
   }
   return vars;
}

function setCIDCookie(cid) {
    var divTag = document.createElement("div");
    divTag.id = 'tuattrdiv';
    document.body.appendChild(divTag);
    var imgTag = document.createElement("img");
    var url = "https://www.truecredit.com/attribution/process/cid?CID=" + cid;
    imgTag.setAttribute('src', url);
    imgTag.style.border = '0px';
    divTag.appendChild(imgTag);
    
    var imgTag2 = document.createElement("img");
    url = "https://truecredit.transunion.com/attribution/process/cid?CID=" + cid;
    imgTag2.setAttribute('src', url);
    imgTag2.style.border = '0px';
    divTag.appendChild(imgTag2);
}

function setCampaign() {
   /* Campaign info set in CID request param. */
   var params = getParams();
   var cid = params["CID"];
   var channel = params["CHANNEL"];
   if (cid && channel) {
      if (channel == 'PAID') {
        setCIDCookie(cid);
    }
   }
}


setCampaign()

