There is one script injected by HubSpot that is executed within 3 seconds after page load. Here it is:
<script> (function () { window.addEventListener('load', function () { setTimeout(function () { var xhr = new XMLHttpRequest(); xhr.open('POST', '/_hcms/perf', true /*async*/); xhr.setRequestHeader("Content-type", "application/json"); xhr.onreadystatechange = function () { // do nothing. }; var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection; function populateNetworkInfo(name, connection, info) { if (name in connection) { info[name] = connection[name]; } } var networkInfo = {}; if (connection) { ['type', 'effectiveType', 'downlink', 'rtt'].forEach(function(name) { populateNetworkInfo(name, connection, networkInfo); }); } var perfData = { url: location.href, portal: 7598952, content: 79688482981, group: -1, connection: networkInfo, timing: performance.timing }; xhr.send(JSON.stringify(perfData)); }, 3000); // Execute this 3 seconds after onload. }); })(); </script>
What is the purpose of this script? It seems that it simply returns "OK" without any real purpose.
My problem is that the endpoint location.href/_hcms/perf returns 404 for my custom domain (configuration is fine, custom domain is connected and fully functional) while the same endpoint returns "OK" for all of my system domains.
Does not affect the functionality in any way but I always see the error message in console log and looks bad. Any method to remove the (apparently) useless script failed.
Any advice about how to get rid of this script or to correct the 404 error?