CMS Development


script injected by HubSpot


There is one script injected by HubSpot that is executed within 3 seconds after page load. Here it is:

(function () {
window.addEventListener('load', function () {
setTimeout(function () {
var xhr = new XMLHttpRequest();'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
}, 3000); // Execute this 3 seconds after onload.


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?


Thanks in advance



1 Reply 1
Community Manager
Community Manager

script injected by HubSpot

Hi, @PMC-RO 👋 thanks for reaching out. Hey @Kevin-C do you have any thoughts or suggestions for @PMC-RO?


Thank you! — Jaycee


Jaycee Lewis

Developer Community Manager

Community | HubSpot