I set Library Management to 'Custom' as I wanted to add some plugins including a customised one. At some point I noticed that they stopped working. I resolved it this way: I ticked the box 'Set report suites using custom code below' and defined s_account inside the library. Surely, this is not the only way to make it work. How can I troubleshoot what is not working correctly? Ideally I'd like to have report suites defined in the DTM UI rather than in the AppMeasurement code. Thanks.
Are you using/calling your plugin functions (Code inserted in Appmeasurement Library) from code on the page (or a developer console) or even non-analytics code blocks in DTM (like Third Party Tags) ? . If yes, then it is happening because at this point in time, by default, DTM creates your analytics object (usually an "s", as in "s.pageName") with a local scope. This means it should be able to be referenced from any custom code blocks within DTM that are tied to your analytics tool.
The only way to overcome the above situation is to define your own "s" object within your library. This does mean you can't let DTM manage your library, but the change you need to make is pretty minor. You need a "Custom" configuration, and you'll need to "Set report suites using custom code below" (since you're essentially going to be overwriting the "s" object that DTM created, where it set your report suites for you) and in this way "s" object is created with a Global Scope.
Also, Can you please confirm that when your plugin code is not working then ,Are you seeing any error in the Dev console like : "Uncaught Reference Error : s is not defined".
Hi Parit Thanks a lot for your reply. Actually, no. I was calling plugins from the AppMeasurement itself. And it stopped working. I managed to fix it by moving plugins and s.doPlugins into the Customise Page Code section. it seems to be working OK now. But I still don't understand why it didn't work in the initial set up as all plugins were configured inside the AppMeasurement code, so should be working fine with the local scope in this case.