43
Views
1
Comments
Mismatched anonymous define() module error when navigating to another screen
Question

Just to make sure: I searched every post on the forum related to this problem, but without any clear answer.

We added a GTM script (just the plain script on Google Tag Platform) to our module and tried several implementations of this script to make it work:
- Add script on module level by required scripts section
- Add script on page level by required scripts section 
- Execute script in Layout webblock OnReady and/or OnRender by RequireScript client action
- Execute script by JS code in Layout webblock OnReady and/or OnRender
- Use Forge component 'GoogleTagManagerReactive' and add the HeaderBlock (and/or BodyBlock) with the right ID.
- And much more...

Problem is that when we navigate to a different screen, we get the error 'There was an error processing your request' with in the console the following 'Mismatched anonymous define() module: function (exports) { 'use strict';'

Even with this error and searching on Google I'm not able to find a clear solution what to do and/or how to fix this. Hopefully someone could help us.

Btw, we even tried this with a module with just 2 sample pages and no additional code.




Mismatched anonymous define.png
2025-04-30 18-21-22
Senthil Nathan A

Hi @Jordy van der Jagt ,

  • Don't use RequireScript or OutSystems Required Scripts feature for GTM.

  • Inject GTM directly using raw JavaScript in a Layout block or a Script tag in the Layout or Main screen (eg. OnReady)

Hope this works.

Thanks,

Senthil


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.