


It seems like the custom code used within a Data Element is executed every time it is used in a page load and events. I feel that this could possible pain point for some custom code, especially if it is something that takes a long time to run. Couldn't the custom code be memorized in the _satellite?
Not sure I follow, but custom script contained in Data Elements should only be run when the DE is called. In other words, when you obtain the value of the Data Element that's returned by the custom code in the
_satellite.getVar("dataElement");
or in the UI fields.
Views
Replies
Sign in to like this content
Total Likes
Hi Jeff,
My comment is about accessing a data element with with custom code will run that custom code each time.
Say I have a data element of the name, "currentSearchQuery" and it uses custom javascript for its' value. Every where I access "currentSearchQuery", my custom javascript is run every time. So if I use it for a rule condition, tag value or calling it directly with _satellite.getVar, my custom javascript is re-run.
Views
Replies
Sign in to like this content
Total Likes
Correct. If you want to avoid re-running your custom script on each access of the Data Element, on first run, you can assign the value(s) to a variable or object property and simply reference the variable or object property in subsequent uses.
That's a great tip to keep in mind.
Views
Replies
Sign in to like this content
Total Likes