Skip to content

Instantly share code, notes, and snippets.

@nocodesupplyco
Last active January 2, 2023 20:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Get UTM Parameter Source From URL
// search the URL as a string
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
// do something if the URL has a specific parameter and it has a value
if (urlParams.has('utm_source') && urlParams.get('utm_source') > "") {
//...do something
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment