Skip to content

Instantly share code, notes, and snippets.

@salsalabs
Created June 22, 2020 19:30
Show Gist options
  • Save salsalabs/a3283f02bc231f3ae37fb90b8f1dfdd5 to your computer and use it in GitHub Desktop.
Save salsalabs/a3283f02bc231f3ae37fb90b8f1dfdd5 to your computer and use it in GitHub Desktop.
Put a wrapper around a script so that it only runs on thank you pages with a donation_KEY and an amount.
// Put this text on a new line just after the <script> tag (https://prnt.sc/t4j44d).
var isThankYouPage = document.location.href.indexOf("thank_you") != -1;
var hasDonationKEY = /donate_page_KEY=\d+/.test(document.location.href);
var hasAmount = /amount=\d+/.test(document.location.href);
if (isThankYouPage && hasDonationKey && hasAmount) {
// Put this text just before the </script> tag (https://prnt.sc/t4j4il).
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment