clearvar() is not working | Community
Skip to main content
Level 2
August 25, 2016
Solved

clearvar() is not working

  • August 25, 2016
  • 1 reply
  • 1036 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ParitMittal

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

1 reply

ParitMittal
ParitMittalAccepted solution
Level 10
August 26, 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