t.getAttribute error on Adobe Dynamic Tag Manager

soumiaz

16-10-2017

I am trying to figure why the following piece of code generates the "SATELLITE: TypeError - t.getAttribute is not a function". The getElementbyClassName returns an array of object but cannot seem to understand why I get the latter error.

var checkmarks = document.getElementsByClassName('togglePanel
  btn-selector togglePanelCheckmark');

  var currentCheckmark = "";
  // Iterating through all the checkmarks
  for (var i = 0; i < checkmarks.length; i++) {
  var classList = checkmarks[i].classList;
  if(classList.value.indexOf('active') !== -1) {
  currentCheckmark = (checkmarks[i].id.split('-')[2]).split('_')[0] + ':
  ' + checkmarks[i].innerText;
  }
  }
  return currentCheckmark;

Any help would be appreciated.

Accepted Solutions (0)

Answers (8)

Answers (8)

lucass68737126

26-06-2018

I had the same issue. To create an Event base rule, I copied an existing Event base rule who had the click condition with the Delay link activation checked and changed the condition of that new rule to dataelementchanged. But it did not unchecked the delay link activation checkbox of the previous condition and that's why the error occurred.

Just go into your rule, change the condition to click, uncheck the delay link activation checkbox and change the condition again. It will do the trick

Thanks @aseelund for the inspiration.

aseelund

18-12-2017

The only place i can find t.getAttribute in visitor API is in the method: "linkNeedsDelayActivate"

Do you have "delay link activation" checked for this rule?

1375746_pastedImage_0.png

Veena_Vikram

MVP

18-10-2017

When you get the error in you browser console if you click on the file mentioned in the console it will give you the exact location in the JS where this error is coming. can you locate it ?

soumiaz

18-10-2017

  The error is coming from the Adove Visitor API for Javascript which is on all pages of my site. Here below is just a snippet that was higlighted. I doubt it is a regular Javascript Error, it seems to be related to Adobe (SATELLITE) but can't figure out in what way.

("SATELLITE: "+a)},flush:function(){this.flushed||(O.each(this.messages,function(e){e[2]!==!0&&(this.echo(e[0],e[1]),e[2]=!0)},this),this.flushed=!0)}},O.notify=O.bind(O.Logger.message,O.Logger),O.cleanText=function(e){return null==e?null:O.trim(e).replace(/\s+/g," ")},O.cleanText.legacy=function(e){return null==e?null:O.trim(e).replace(/\s{2,}/g," ").replace(/[^\000-\177]*/g,"")},O.text=function(e){return e.textContent||e.innerText},O.specialProperties={text:O.text,cleanText:function(e){return O.cleanText(O.text(e))}},O.getObjectProperty=function(e,t,n){for(var i,r=t.split("."),s=e,o=O.specialProperties,c=0,l=r.length;l>c;c++){if(null==s)return a;var u=r[c];if(n&&"@"===u.charAt(0)){var d=u.slice(1);s=o[d](s)}else if(s.getAttribute&&(i=u.match(/^getAttribute\((.+)\)$/))){var p=i[1];s=s.getAttribute(p)}else s=s[u]}return s},O.getToolsByType=function(e){if(!e)throw new Error("Tool type is missing");var t=[];for(var a in O.tools)if(O.tools.hasOwnProperty(a)){var n=O.tools[a];n.settings&&n.settings.engine===e&&t.push(n)}return t},O.setVar=function(){var e=O.data.customVars;if(null==e&&(O.data.customVars={},e=O.data.customVars),"string"==typeof arguments[0]){var t=arguments[0];e[t]=arguments[1]}else if(arguments[0]){var a=arguments[0];for(var n in a)a.hasOwnProperty(n)&&(e[n]=a[n])}},O.dataElementSafe=function(e,t){if(arguments.length>2){var a=arguments[2];"pageview"===t?O.dataElementSafe.pageviewCache[e]=a:"session"===t?O.setCookie("_sdsat_"+e,a):"visitor"===t&&O.setCookie("_sdsat_"+e,a,730)}else{if("pageview"===t)return O.dataElementSafe.pageviewCache[e];if("session"===t||"visitor"===t)return O.readCookie("_sdsat_"+e)}},O.dataElementSafe.pageviewCache={},O.realGetDataElement=function(t){var a;return t.selector?O.hasSelector&&O.cssQuery(t.selector,function(e){if(e.length>0){var n=e[0];"text"===t.property?a=n.innerText||n.textContent:t.property in n?a=n[t.property]:O.hasAttr(n,t.property)&&(a=n.getAttribute(t.property))}}):t.queryParam?a=t.ignoreCase?O.getQueryParamCaseInsensitive(t.queryParam):O.getQueryParam(t.queryParam):t.cookie?a=O.readCookie(t.cookie):t.jsVariable?a=O.getObjectProperty(e,t.jsVariable):t.customJS?a=t.customJS():t.contextHub&&(a=t.contextHub()),O.isString(a)&&t.cleanText&&(a=O.cleanText(a)),a},O.getDataElement=function(e,t,n){if(n=n||O.dataElements[e],null==n)return O.settings.undefinedVarsReturnEmpty?"":null;var i=O.realGetDataElement(n);return i===a&&n.storeLength?i=O.dataElementSafe(e,n.storeLength):i!==a&&n.storeLength&&O.dataElementSafe(e,n.storeLength,i),i||t||(i=n["default"]||""),O.isString(i)&&n.forceLowerCase&&(i=i.toLowerCase()),i},O.getVar=function(n,i,r){var s,o,c=O.data.customVars,l=r?r.target||r.srcElement:null,u={uri:O.URI(),protocol:t.location.protocol,hostname:t.location.hostname};if(O.dataElements&&n in O.dataElements)return

soumiaz

18-10-2017

Hello @Veena_07. Thanks for the response. That is what I am thinking also but I am getting the Satellite error everytime I click on a an element with the specified class mentioned above. Any possible workarounds ?