When passing arguments to velocity render, the datalayer and ga4datalayer may become too big and breaks velocity rendering.
This can happen in product listing pages, when you increase the ammount of products shown (in my case, above 45 products breaks it).
I couldn't find it, but it seems that there is a limit on the size of the arguments passed to the wainclude / velocity.render. I calculate the limit is something between 15.000/16.000 characters on the URL argument. I'm contacting salesforce support to check it.
This results in the following error on logcenter: (i replaced the JSON data chunks with [...tooMuchData])
message:
category: external.logger
severity: ERROR
thread: ...
time: ...
text: application Error processing includes. In Request [/search]; isScapiRequest [false]; invalid wainclude source tag ignored [<wainclude url="/on/demandware.store/Sites-MySite-Site/en_US/GTM-HtmlHead?action=Search-Show&datalayer=[...tooMuchData]&ga4datalayer=[...tooMuchData]
...(truncated)...
Steps to reproduce:
On your SFCC project with GTM activated, increase the ammount of products shown on an search page or category page (try 100 products). This will generate the error above and breaks GTM rendering.
Function causing the issue
|
function htmlHead(pdict) { |
|
if (gtmHelpers.isEnabled) { |
|
var datalayer = gtmHelpers.getDataLayer(pdict, false); |
|
var ga4datalayer = gtmHelpers.isGA4Enabled ? gtmHelpers.getDataLayer(pdict, true) : false; |
|
|
|
velocity.render( |
|
"$velocity.remoteInclude('GTM-HtmlHead', 'action', $action, 'datalayer', $datalayer, 'ga4datalayer', $ga4datalayer, 'gtmEnabled', $gtmEnabled)", |
|
{ |
|
velocity: velocity, |
|
action: pdict.action, |
|
datalayer: datalayer ? JSON.stringify(datalayer) : false, |
|
ga4datalayer: ga4datalayer ? JSON.stringify(ga4datalayer) : false, |
|
gtmEnabled: gtmHelpers.isEnabled |
|
} |
|
); |
|
} |
|
} |
When passing arguments to velocity render, the
datalayerandga4datalayermay become too big and breaks velocity rendering.This can happen in product listing pages, when you increase the ammount of products shown (in my case, above 45 products breaks it).
I couldn't find it, but it seems that there is a limit on the size of the arguments passed to the wainclude / velocity.render. I calculate the limit is something between 15.000/16.000 characters on the URL argument. I'm contacting salesforce support to check it.
This results in the following error on logcenter: (i replaced the JSON data chunks with
[...tooMuchData])message: category: external.logger severity: ERROR thread: ... time: ... text: application Error processing includes. In Request [/search]; isScapiRequest [false]; invalid wainclude source tag ignored [<wainclude url="/on/demandware.store/Sites-MySite-Site/en_US/GTM-HtmlHead?action=Search-Show&datalayer=[...tooMuchData]&ga4datalayer=[...tooMuchData] ...(truncated)...Steps to reproduce:
On your SFCC project with GTM activated, increase the ammount of products shown on an search page or category page (try 100 products). This will generate the error above and breaks GTM rendering.
Function causing the issue
sfcc-plugin-gtm/cartridges/plugin_gtm/cartridge/scripts/hooks/gtm/gtmhooks.js
Lines 11 to 27 in b58bfc4