// attach a boolean to the window object to indicate if we've already run this script
if (!window.queryStringDone) {
  window.queryStringDone = true;

  // If we got a query string, pass it on to all links on the page, except if they already have a query string
  const queryString = window.location.search;
  const collection = document.getElementsByTagName("a");

  if (queryString !== "") {
    for (key in collection) {
      if (!collection[key].href) {
        continue;
      }

      if (collection[key].href.indexOf("?") !== -1) {
        continue;
      }

      collection[key].href += queryString;
    }
  }
}
