Expand my Community achievements bar.

SOLVED

clearvar() is not working

Avatar

Level 2

Hello,

We've implementend dtm on an SPA. In the condition of every rule we have the following script

var s = _satellite.getToolsByType('sc')[0].getS();
s.clearVars();
return true;

The strange thing is that for pages with load times with longer load times (more than 4 seconds) we get the following error and the rule will not fire:

SATELLITE: Condition for rule "AA: page load" not met. Error: Cannot read property 'clearVars' of null

How can we fix this problem?

*On each page load a rondomID is set in the dataLayer. We use this as trigger for the rule. (dataelementchanged)

Regards,

 

Guido

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Guidov ,

The Root cause of the problem is that When the pages with load times (more than 4 seconds)   load, Actually the call to Event based rule is getting fired even before the Adobe Analytics "S" object is instantiated  and it is because of the fact that as the page Reloads the the datalayer Element Page Id is changed with random id and then "Data Element changed" event type which constantly polls data element value detects change in data element and the event based rule fires even before the s object is initialized.

Hence There is need to alter the way current implementation is done such that when the Page Is fully loaded then only the data layer element is set with Random ID

Thanks & Regards

Parit Mittal

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi Guidov ,

The Root cause of the problem is that When the pages with load times (more than 4 seconds)   load, Actually the call to Event based rule is getting fired even before the Adobe Analytics "S" object is instantiated  and it is because of the fact that as the page Reloads the the datalayer Element Page Id is changed with random id and then "Data Element changed" event type which constantly polls data element value detects change in data element and the event based rule fires even before the s object is initialized.

Hence There is need to alter the way current implementation is done such that when the Page Is fully loaded then only the data layer element is set with Random ID

Thanks & Regards

Parit Mittal