
window.addEventListener('load', function(event) {
  var xhr = new XMLHttpRequest();
  xhr.withCredentials = true;
  xhr.open(
    'POST',
    '/click-stream-event/page-loaded',
    true
  );
  xhr.setRequestHeader('Content-type', 'application/json');
  xhr.send(JSON.stringify({
      key: '7p1TfPImg88YcMB8j2fc6WRVIzXwniBNh8A6NcQg',
      document_location: document.location.href,
      document_referrer: document.referrer,
      host: document.location.host,
      pathname: document.location.pathname,
      protocol: document.location.protocol,
      search: document.location.search,
    }));
});
