clearvar() is not working

guidov61672237

25-08-2016

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

Accepted Solutions (1)

Accepted Solutions (1)

ParitMittal

26-08-2016

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

Answers (0)