Support » Plugin: GTM4WP » Uncaught SyntaxError: Unexpected token ‘<' (optimize-add.js)

  • Hello,

    Thanks for creating this plugin, it seems to work great!

    I just have one issue, it seems since enabling it, I am getting the following JS error in console on every page: “Uncaught SyntaxError: Unexpected token ‘<‘ (optimize-add.js)”

    Do you know what might be causing this? Please note I’m using Google Optimize & WP Rocket on the site.


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Thomas Geiger



    optimize-add.js is not part of GTM4WP.
    Perhaps there is an issue within another plugin or within your GTM container.

    Have you tried to change the GTM ID in plugin settings to GTM-XXXX?
    If the error message disappears after this change (also purge WP Rocket cache after saving the changes), then the issue is within your GTM container and in in GTM4WP.

    Thread Starter j2fb


    Thanks for your reply. The error went away when I disabled WP Rocket, so it seems to be related to WP Rocket – I will contact their support.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Uncaught SyntaxError: Unexpected token ‘<' (optimize-add.js)’ is closed to new replies.