Just thought I would share this code snippet I came up with for being able to use the same file on production and staging (the webflow.io url)
var Webflow = Webflow || [];
Webflow.push(function () {
//Put code that should between both here
console.log("both staging and production");
//Staging vs production code below
//This detects if webflow is the TLD
var isStaging = window.location.mld = function() {return window.location.hostname.split('.').reverse()[1];}();
if (isStaging === "webflow") {
//Only on staging
console.log("staging only");
}
//Code you only want to run on production
else {
//Only on production
console.log("production only");
}
});