Try it live

From the console

curl "https://utm.distributed.sh/?utm_source=google&utm_campaign=campaignName&utm_medium=medium&utm_content=content&utm_term=term"

# =>
# {
#   "utm_source": "google",
#   "utm_campaign": "campaignName",
#   "utm_medium": "medium",
#   "utm_content": "content",
#   "utm_term": "term"
# }

Using fetch

// location.search => ?utm_source=google&utm_campaign=campaignName&utm_medium=medium&utm_content=content&utm_term=term
const utms = await fetch(`https://utm.distributed.sh/${location.search}`).then(res => res.json());

console.table(utms);

/* =>
{
  "utm_source": "google",
  "utm_campaign": "campaignName",
  "utm_medium": "medium",
  "utm_content": "content",
  "utm_term": "term"
}
/*
Edit this page on GitHub Updated at Fri, Aug 26, 2022