Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

DTM Custom Code Data Rules Evaluates Everytime

Avatar

Avatar
Validate 1
Level 2
andrewgats
Level 2

Likes

3 likes

Total Posts

6 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
andrewgats
Level 2

Likes

3 likes

Total Posts

6 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
andrewgats
Level 2

15-10-2015

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?

Replies

Avatar

Avatar
Seeker
Employee
Jeff__Chasin
Employee

Likes

12 likes

Total Posts

36 posts

Correct Reply

12 solutions
Top badges earned
Seeker
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Seeker
Employee
Jeff__Chasin
Employee

Likes

12 likes

Total Posts

36 posts

Correct Reply

12 solutions
Top badges earned
Seeker
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile
Jeff__Chasin
Employee

15-10-2015

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.

Avatar

Avatar
Validate 1
Level 2
andrewgats
Level 2

Likes

3 likes

Total Posts

6 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
andrewgats
Level 2

Likes

3 likes

Total Posts

6 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
andrewgats
Level 2

15-10-2015

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.

Avatar

Avatar
Seeker
Employee
Jeff__Chasin
Employee

Likes

12 likes

Total Posts

36 posts

Correct Reply

12 solutions
Top badges earned
Seeker
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Seeker
Employee
Jeff__Chasin
Employee

Likes

12 likes

Total Posts

36 posts

Correct Reply

12 solutions
Top badges earned
Seeker
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile
Jeff__Chasin
Employee

15-10-2015

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.

Avatar

Avatar
Validate 1
Level 2
Cleve_Young
Level 2

Likes

7 likes

Total Posts

19 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
Cleve_Young
Level 2

Likes

7 likes

Total Posts

19 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
Cleve_Young
Level 2

15-10-2015

That's a great tip to keep in mind.