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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Better Control over Data Element Evaluation

Avatar

Level 2

On idea:

 

I'd like more control over how and when data elements are evaluated.

 

Issue:

You have a data element that accesses an object/property: "page.name[0].length"

If that object or property doesn't exist (or you know it will show up later), JS throws undefined errors as soon as the page loads.

 

Idea:

If I could say something like "delay initial execution" - and in theory what it would do is only evaluate the DE when it's called upon in a rule, that might help.  The rule could be based on a Custom Event or a Direct Call, where I know the object is present

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @J2_2 

Yeah this issues is obvious me and my team had experience same many times so at first I'll suggest to add fail safe check for particular object/method and see if that's available in page, if so then only do further steps. 

And what @yuhuisg highlighted below that too take into consideration. 

View solution in original post

5 Replies

Avatar

Community Advisor

Launch evaluates data elements when they are referenced. In your case, you should use your data element with a relevant rule that runs after a suitable "delay initial execution" period.

That means when your Custom Event/Direct Call/other event triggers, then you should assume that your data element will be able to evaluate as expected. If you can't assume that, then you need to delay your Custom Event/Direct Call/other trigger until the data element can evaluate as expected.

Avatar

Level 2

Yeah that's the issue - the Data Elements are evaluated when they are referenced, and they are referenced immediately on page load, when Launch instantiates, which is where errors occur.

 

This means you load your page, fire a thousand reference errors, and then later, when a rule references the DE, then it works correctly.  If you can delay initial execution, you won't have to enclose all your DE's in try{}catch(){} blocks to handle the errors

Avatar

Correct answer by
Community Advisor

Hi @J2_2 

Yeah this issues is obvious me and my team had experience same many times so at first I'll suggest to add fail safe check for particular object/method and see if that's available in page, if so then only do further steps. 

And what @yuhuisg highlighted below that too take into consideration. 

Avatar

Level 2

Yeah we do that today for sure 🙂  - it'd just be nice if Adobe could solve for that.... The Avg marketer doesn't know how to write a tryCatch, but they can check a box, which means I could focus on other things rather than stopping to customize every single data element in the company.

 

Avatar

Community Advisor

in that case it's time for Avg. marketer to become tech marketer 😉 and learn basic things.