Last active
February 26, 2024 21:40
-
-
Save cliffordp/f4aa43badd4d99cee537a82ff0e5ab3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UNNECESSARY. DO NOT USE. | |
// Do this instead: https://help.gohighlevel.com/support/solutions/articles/48001172004 | |
<script id="bizname-enforce-default-url-query-param"> | |
// Source: https://gist.github.com/cliffordp/f4aa43badd4d99cee537a82ff0e5ab3b | |
// Video: https://youtu.be/MHKzHf1BhrY | |
// Function to check for the 'bizname' query parameter and redirect if not present. | |
(function enforceDefaultBiznameQueryParam() { | |
const urlParams = new URLSearchParams(window.location.search); | |
const bizname = urlParams.get('bizname'); | |
// If 'bizname' query param is not present or is an empty string, redirect. | |
if (bizname === null || bizname.trim() === '') { | |
// Construct the new URL with the default 'bizname' query parameter. | |
const currentUrl = new URL(window.location.href); | |
currentUrl.searchParams.set('bizname', 'Your Business Name'); | |
window.location.href = currentUrl.toString(); | |
} | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment