happy monday folks!
i'm using velocity script (via email script tokens) to show personalized content in my marketing emails. Im at the point where I am no longer able to add more personalization scenarios within my emails has I've hit the velocity script size limit:Cannot get email content- <div>An error occurred when procesing the email Rendered_Email_Velocity_Error_Area_?! </div> <p>The total scripts size is 111901, exceeding the limit size. near</p> <div><pre >?</pre></div>
the direct solve is probably to scale back on the personalization but i'm wondering if anyone is aware of some sort of velocity script truncation tool?
Solved! Go to Solution.
Hi @Khyra
1) Evaluate if Some Content Can Shift to Segementaion as Marketo segmentations can often replicate some personalization logic with better performance.
2) Also, you can modularize repeating logic please check example below.
Before :
#if($lead.favoriteColor.equals("blue"))
Welcome, Blue Lover!
#elseif($lead.favoriteColor.equals("red"))
Welcome, Red Fan!
#elseif($lead.favoriteColor.equals("green"))
Welcome, Green Goblin!
#end
After :
#set($colorMap = {
"blue": "Blue Lover",
"red": "Red Fan",
"green": "Green Goblin"
})
#if($colorMap.containsKey($lead.favoriteColor))
Welcome, ${colorMap.get($lead.favoriteColor)}!
#end
(This brief example only saves a few bytes, but you can see how in the real world the savings can be huge.)
Note : There is no official Velocity script truncation tool that automates reduction while preserving logic.
Thanks
Hi @Khyra
1) Evaluate if Some Content Can Shift to Segementaion as Marketo segmentations can often replicate some personalization logic with better performance.
2) Also, you can modularize repeating logic please check example below.
Before :
#if($lead.favoriteColor.equals("blue"))
Welcome, Blue Lover!
#elseif($lead.favoriteColor.equals("red"))
Welcome, Red Fan!
#elseif($lead.favoriteColor.equals("green"))
Welcome, Green Goblin!
#end
After :
#set($colorMap = {
"blue": "Blue Lover",
"red": "Red Fan",
"green": "Green Goblin"
})
#if($colorMap.containsKey($lead.favoriteColor))
Welcome, ${colorMap.get($lead.favoriteColor)}!
#end
(This brief example only saves a few bytes, but you can see how in the real world the savings can be huge.)
Note : There is no official Velocity script truncation tool that automates reduction while preserving logic.
Thanks
1) Marketo segmentations can often replicate some personalization logic with better performance.
Marked your post as correct, though I doubt you can substantiate this claim for scenarios where Velocity and Segmentations can both do the job. (That is, when you’re not doing things that can only be done with Velocity like working with COs.)
Not clear what you could mean by “truncation tool”. You can’t just truncate code at an arbitrary point or the whole thing breaks (think about truncating before a closing #end
!).
Anyway, it’s impossible to give suggestions without seeing your code. 100KB is a very high limit. Maybe you’re repeating strings that could be brought into a constant $variable
. Or otherwise inlining stuff that could be inside a #foreach
loop.