Related report: Browser.application doesn't work with popular Analytics approaches
And for those interested in the hack, we did this in our gulp compilation pipeline:
// Monkey patch step to work around Elm's Browser.application deficiencies.
// Please see VENDORHACKS.md for more details
gulp.task("build:scripts:elm:monkey-patch", () => {
const originalApplicationBodyLoadingCode = "var bodyNode = _VirtualDom_doc.body;"
const isolatedApplicationBodyLoadingCode = 'var bodyNode = _VirtualDom_doc.getElementById("elmIsolationContainer");'
return gulp
.src(output)
.pipe($.replace(originalApplicationBodyLoadingCode, isolatedApplicationBodyLoadingCode))
.pipe(gulp.dest(outputPath))
})