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"
}
/*