Skip to content

Instantly share code, notes, and snippets.

@danielpaul
Created January 29, 2025 19:38
Show Gist options
  • Save danielpaul/47d0c38f08d8b8ae75f3cd8252599586 to your computer and use it in GitHub Desktop.
Save danielpaul/47d0c38f08d8b8ae75f3cd8252599586 to your computer and use it in GitHub Desktop.
CookieChimp JS on SPA
<script is:inline>
function runCookieChimp() {
var script = document.createElement("script");
script.src = "http://localhost:3000/widget/K8ktWD.js";
script.id = "cookiechimp-js";
document.head.appendChild(script);
}
// for Astro JS.
// listen for other events for different frameworks.
document.addEventListener("astro:page-load", runCookieChimp);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment