Hi - I've branched your reply off into it's own question. This will allow us to troubleshoot and answer your question. Are you deploying your app measurement file via DTM? If not, I'll move this to the Analytics community.
You could also test to see if that is the issue by removing the plug-in from the custom section and instead just write some code that references the s object. If you get a similar error, you know it's a scoping issue.