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

Custom code in "Set Variable" section executing asynchronously

Avatar

Avatar
Validate 1
Level 2
rupaljain2408
Level 2

Likes

8 likes

Total Posts

23 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
rupaljain2408
Level 2

Likes

8 likes

Total Posts

23 posts

Correct Reply

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

09-05-2019

Hi All,

We have recently migrated our property from Adobe DTM to Launch. I have a direct call rule, in which evars and props are set using mapping at UI level in Launch, however events and products are set in the custom code of same section "Set Variables" under Action in launch.

Now , the call to DCR has been written like this in code controller :

try {

      window._satellite.track('commonsPageLoad');

    } catch (error) {

      console.error(error);

    } finally {

      window.digitalData = {};

    }

Here, before DCR fully gets executet ,i.e., before image request getting fired , datalayer gets emptied from finally block. It results in loss of data , when image request is fired

Is it due to custom code executing asynchronously ? Can anyone please help on this, what needs to be done.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 4
gflare
Level 4

Likes

33 likes

Total Posts

52 posts

Correct Reply

18 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
gflare
Level 4

Likes

33 likes

Total Posts

52 posts

Correct Reply

18 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
gflare
Level 4

16-05-2019

The direct call is made in a synchronous manner - but you can think of all the subsequent activity of the rule running afterwards. The execution of another Rule Trigger is completely external to the initial direct call line, so there's no control on timing there.

If you need to control the timing, you do have a few options...

Option 1 (do it yourself): create your own callback, promise, or other control alongside your DCR to ensure it does no continue until the timing you desire.

Option 2 (let Launch do it): If you perform this same type of call in a series of conditions of a rule, Launch will control the execution of the other Trigger (the DCR Rule) to be completed before continuing onward within the current Trigger.

Answers (2)

Answers (2)

Avatar

Avatar
Validate 1
Level 8
thomas_amsler
Level 8

Likes

243 likes

Total Posts

159 posts

Correct Reply

26 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 8
thomas_amsler
Level 8

Likes

243 likes

Total Posts

159 posts

Correct Reply

26 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
thomas_amsler
Level 8

15-05-2019

You could also provide the required data as a payload with the tracking call, to be sure to have its data available.

If you empty digitalData anyway at the end, why do you even have it?

Avatar

Avatar
Validate 10
Level 4
stefanm38281801
Level 4

Likes

43 likes

Total Posts

51 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Contributor
Shape 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 10
Level 4
stefanm38281801
Level 4

Likes

43 likes

Total Posts

51 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Contributor
Shape 1
Give Back 5
Give Back 3
View profile
stefanm38281801
Level 4

10-05-2019

Hi,

from my understanding of how the direct call rule is replaced with an event capture rule in Launch, I suppose it is indeed running asynchronous.

So I suggest you move the clearing of your digitalData to an action event (custom script), after the action(s), where you process the rule.

Due to the action sequencing, in the order you set in the actions, you'll be sure that the data is cleared "after" processing.

Stefan