I have a lightning component which I'm trying to connect with Tag Manager. I followed the instructions in the tag manager page, first saved the js code as a static resource Js in tag manager page

then called that script with the ltng:require tag


pasted the iFrame tag, obviously without the noscript around it because lightning doesn't support noscript tag

iFrame tag

but when I activate the preview mode in Tag Manager and reload the page nothing happens and in the console this error appears


I've tried to solve this issue adding https://www.googletagmanager.com to the CSP trusted sites such as described in this link https://help.salesforce.com/articleView?id=csp_trusted_sites.htm&type=5

also downgraded the lightning component api version in order to disable lightning locker for the component https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/security_ls_disable.htm

and disabled stricter CSP restrictions https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/security_csp_stricter.htm

but the error still occurs do you have any idea or is there something am I missing?

  • Welcome to SFSE. Please make an edit to include code and error messages as text, not images. Use the {} tool in the editor to format code inclusions – David Reed Apr 17 '20 at 20:48
  • Check this article, may be it can be helpful: developer.salesforce.com/blogs/2019/04/… – Matías Quintana Apr 17 '20 at 21:11
  • David thanks for your suggestion is so much appreciated and also thanks Matías but I checked the article I'll try to adapt it for lightning – Jesús Sánchez Apr 20 '20 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.