korbinian
korbinian

Reputation: 1

GTM "Invalid HTML, CSS or JavaScript found in template"

I am trying to use GTM's "Custom HTML Tag" option with the following code but it is giving me the following error: Invalid HTML, CSS, or JavaScript found in template.

I have implemented snippets from this source (taboola) before... I'm wondering what in this code is breaking it. Otherwise the code seems to be standard javascript:

<script>
_tfa.push({notify: 'event', name: 'landing_page_view', id: 1322998});
</script>
<noscript>
<img src='https://trc.taboola.com/1322998/log/3/unip?en=landing_page_view'
    width='0' height='0' style='display:none' referrerpolicy='no-referrer-when-downgrade'/>
</noscript>

I am grateful for any recommendations to solve the problem :)

Upvotes: 0

Views: 1219

Answers (2)

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

GTM is a Javascript injector that will not do much without JS, so it is pointless to use it to implement a noscript tag.

However the actual problem are the non-standard attributes (a problem that might affect other tags than an image inside a noscript tag). So while in this particular case you can remove the noscript tag and its contents altogether, in other cases it would be sufficient to check which attributes Google deems valid for a given tag.

Note that the Google linter sometimes complains about attributes that otherwise would be considered okay, in your case the problem is the referrerpolicy attribute.

Upvotes: 1

XTOTHEL
XTOTHEL

Reputation: 5208

Remove the "noscript" section.

Upvotes: 0

Related Questions