Highlighted

s-code-content file to execute first before direct call rule file

Avatar

Avatar

peter_paul

Avatar

peter_paul

peter_paul

04-07-2016

Hi Adobe Community,

How can I make sure the s-code-content is executed before the direct call rule?  window.s inside my direct call rule is undefined because initialization of variable s (var s = new AppMeasurement() ) is called after my direct call rule based on the logs I placed in each files. Below is the situation.

I am using a Direct Call Rule but when I assigned a value to the variable, console said it is undefined (please see image). I realized the variable s below found in s-code-content-xxx.js file is not yet executed. 

var s = new AppMeasurement();

Sometimes it has a value, sometimes it does not have depending on how the sequence is rendered. I added logs to the 2 main files (satelliteLib-xxx-staging.js and s-code-contents-xxx-staging.js) and the file of the direct call rule that is fired (satellite-xxx-staging.js) to see the sequence they are called.

If there is value, the sequence is this which makes sense because variable s above is initialized first before calling the direct call rule:
1. satelliteLib-xxx-staging.js (contains code that calls the 2 files below and is the one required by Adobe to be the first line of script to be called inside <head> tag)
2. s-code-content-xxx-staging.js (contains var s = new AppMeasurement);
3. satellite--xxx-staging.js (contains the direct call rule fired by the page that has undefined because variable s is also undefined - please see image above)

If there is NO value like in the screenshot above,its sequence is this (based on the logs i inserted)

1. satelliteLib-xxx-staging.js
2.  satellite--xxx-staging.js 

3. s-code-content-xxx-staging.js

The Direct Call Rule code snippet below in the screenshot is found inside satellite-xxx-staging.js and at this time window.s is called, it is still undefined because this file was called earlier earlier than s-code-content-xxx-staging.js

 

Hope to get a solution for this. Thank you so much!

Regards,
Peter

Replies

Highlighted

Avatar

Avatar

ParitMittal

Avatar

ParitMittal

ParitMittal

15-07-2016

Hi Peter, 

Please share your DTM Account Login details as well as test url of the website in a private message so that we can debug the issue at our end. 

Thanks & Regards

Parit Mittal