Event-based rules not capturing dynamic reporting suite within "Customize Page Code"

laura_vl

20-07-2016

Within the Adobe Analytics tool, under Code Configuration, I have it set to "Custom" and the option for "Set reporting suites using custom code below" is checked. Then I have the code hosted within DTM and am loading the latest version of AppMeasurement  v.1.6.1.

At the top of the code block within "Code Configuration" I have the following code prior to loading the plugins and the AppMeasurement library:

var s = new AppMeasurement();

Then, within "Customize Page Code", I have the following:

s.sa( _satellite.getDataElement('reportingSuite') );

When I fire an event-based rule, this function that sets the reporting suite is not being called and I get an error within the console "SATELLITE: Adobe Analytics: tracker not initialized because account was not found" and "SATELLITE: Adobe Analytics: page code not loaded".

Some blogs have mentioned the only way to get around this within event-based rules is not used the Adobe Analytics tool and manually set your variables within the custom JavaScript section. I find it hard to believe that is the only solution so I am hoping someone here can offer some advice. 

Accepted Solutions (1)

Accepted Solutions (1)

ParitMittal

21-07-2016

Hi Laura,

The problem is with the s.sa() function you are using.  It is not recommended to initialize a report suite using s.sa() function.The s.sa() function only lets you dynamically change a report suite at any time on the page, before or after an image request fires.

Hence please use the following code to in "customize page code" to properly initialize  the report suite id to be used for Page Load Rules and Event Based rules.

var r_suite = _satellite.getDataElement('reportingSuite') ; s_account=r_suite; s.account=s_account;

Thanks & Regards

Parit Mittal

Answers (3)

Answers (3)

laura_vl

28-07-2016

Hi Parit,

This solution works as expected, but on page load I still get the following error:

SATELLITE: Adobe Analytics: tracker not initialized because account was not found

The server calls seem to be firing properly however. Should I be worried about this error?

Thank you,

Laura

andrew_r-GrfLbX

21-07-2016

I use the following code within my analytics tool and never have an issue with events firing or anything, hopefully it might be of some use.

var suiteId //store the s.account if(location.host == ("sitea.com"))  { suiteId = 'mycompany-sitea-prod'; } else if (location.host == ("siteb.com")){ suiteId= 'mycompany-siteb-prod'; } else if (location.host == ("subsite.sitea.com")){ suiteId= 'mycompany-sitec-prod'; } else { suiteId= 'mycompany-sitea-staging'; } s_account = suiteId; //override the DTM reporting suite var s=s_gi(s_account);

I'd maybe try something along the lines of the following and see how that works for you:

s_account =  _satellite.getDataElement('reportingSuite'); var s=s_gi(s_account);