From c02e7fb4b6ce44e2471a04d220e5ecbcf64b9af2 Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 19 Sep 2025 10:08:28 -0400 Subject: [PATCH] add plausible script injector --- script.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/script.js b/script.js index de4f383..3668a1e 100644 --- a/script.js +++ b/script.js @@ -225,3 +225,30 @@ function checkStatus() { // Update status every second setInterval(checkStatus, 1000); + +function injectPlausibleScript() { + const plausibleDomain = "beachpartyballoons.com"; + const scriptUrl = "https://metrics.beachpartyballoons.com/js/script.hash.outbound-links.js"; + + // Create the main script element + const script = document.createElement('script'); + script.setAttribute('defer', ''); + script.setAttribute('data-domain', plausibleDomain); + script.setAttribute('src', scriptUrl); + + // Create the global plausible function snippet + const functionScript = document.createElement('script'); + const functionContent = ` + window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }; + `; + functionScript.textContent = functionContent; + + // Append both scripts to the document's + document.head.appendChild(script); + document.head.appendChild(functionScript); + + console.log('Plausible script and function have been injected into the head.'); + } + + // Run the function when the window loads. + window.onload = injectPlausibleScript;