🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Update ScriptBuilder component to include script tags in generated JavaScript snippets
Bill Yang1ae53a3fd829
diff --git a/client/src/components/SiteSettings/ScriptBuilder.tsx b/client/src/components/SiteSettings/ScriptBuilder.tsxindex 713761cd5..b3abb02f2 100644--- a/client/src/components/SiteSettings/ScriptBuilder.tsx+++ b/client/src/components/SiteSettings/ScriptBuilder.tsx@@ -107,13 +107,15 @@ ${dataAttributes.map(attr => ` ${formatAttr(attr)}`).join("\n")}defer></script>`;- const jsSnippet = `(function () {+ const jsSnippet = `<script>+(function () {var el = document.createElement("script");el.src = "${scriptUrl}";${dataAttributes.map(([key, value]) => ` el.setAttribute("${key}", ${JSON.stringify(value)});`).join("\n")}el.defer = true;document.head.appendChild(el);-})();`;+})();+</script>`;const inlineScript = `<script src="${scriptUrl}" ${dataAttributes.map(formatAttr).join(" ")} defer></script>`;