I’m using Piwik in my Meteor app. Piwik gives me an HTML snippet to append to my body tag. For various complicated reasons, it’s really best that I use this snippet and not some other fancy API-based Piwik integration.
I’ve tweaked the snippet a bit to check process.env.NODE_ENV. If it is “development”, I don’t load the analytics code so developing my app doesn’t send events to Piwik.
Meteor 1.2.1 and early 1.3 betas/RCs used to place body content after Meteor scripts, so by the time the Piwik snippet was evaluated,
process existed. Now, unfortunately for this setup, the script tag I added to the
<body/> element is placed before Meteor’s own scripts.
I understand and mostly agree with the benefits this offers, but in this case I really do need this particular
<script/> tag to come last. Is there any way to ensure that this particular snippet of HTML is evaluated after everything else? And again, I can’t use some other Piwik integration (Piwik runs in Sandstorm which uses its own custom auth method unsupported by other integrations) so it has to be done this way.