From 20f9c03d3d9a5b6f2656642d563dff6e3eba15b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrea=20Vel=C3=A1squez?=
<33611986+a4vg@users.noreply.github.com>
Date: Mon, 18 Mar 2024 11:59:02 -0500
Subject: [PATCH] docs(SvelteKit): fix Google Tag Manager example
---
docs/sveltekit.md | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/docs/sveltekit.md b/docs/sveltekit.md
index dac41049..afefe80a 100644
--- a/docs/sveltekit.md
+++ b/docs/sveltekit.md
@@ -50,7 +50,11 @@ Adapting from [the HTML integration guide](https://partytown.builder.io/html)
## 3. Then add 3rd party scripts
-This is where we use partytown to add those scripts (note `type="text/partytown"` below). This example shows Google Tag Manager. Putting it together with the previous changes, our `+layout.svelte` looks like:
+This is where we use partytown to add those scripts (note `type="text/partytown"` below). If your script declares global functions or variables, make sure they are explicitly declared with `window`.
+
+This example shows Google Tag Manager. Note `window.gtag = function()` instead of `function gtag()`.
+
+Putting it together with the previous changes, our `+layout.svelte` looks like:
```svelte
// src/routes/+layout.svelte
@@ -74,7 +78,7 @@ This is where we use partytown to add those scripts (note `type="text/partytown"