@nekm/svelte-core 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,12 +10,21 @@
|
|
|
10
10
|
readonly id: string;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Base domain to the site.
|
|
13
|
+
* Base domain to the production site. If the current domain does not match
|
|
14
|
+
* this, then Google Analytics will send debug data only.
|
|
14
15
|
*/
|
|
15
|
-
readonly
|
|
16
|
+
readonly productionDomain?: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
const { id,
|
|
19
|
+
const { id, productionDomain }: GoogleAnalyticsProps = $props();
|
|
20
|
+
|
|
21
|
+
function createConfig() {
|
|
22
|
+
if (!productionDomain) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return page.url.hostname !== productionDomain ? { debug_mode: true } : {};
|
|
27
|
+
}
|
|
19
28
|
|
|
20
29
|
onMount(() => {
|
|
21
30
|
window.dataLayer = window.dataLayer || [];
|
|
@@ -23,8 +32,7 @@
|
|
|
23
32
|
window.dataLayer.push(arguments);
|
|
24
33
|
}
|
|
25
34
|
window.gtag("js", new Date());
|
|
26
|
-
|
|
27
|
-
window.gtag("config", id, config);
|
|
35
|
+
window.gtag("config", id, createConfig());
|
|
28
36
|
|
|
29
37
|
return browserImportScript(`https://www.googletagmanager.com/gtag/js?id=${id}`);
|
|
30
38
|
});
|
|
@@ -4,9 +4,10 @@ export interface GoogleAnalyticsProps {
|
|
|
4
4
|
*/
|
|
5
5
|
readonly id: string;
|
|
6
6
|
/**
|
|
7
|
-
* Base domain to the site.
|
|
7
|
+
* Base domain to the production site. If the current domain does not match
|
|
8
|
+
* this, then Google Analytics will send debug data only.
|
|
8
9
|
*/
|
|
9
|
-
readonly
|
|
10
|
+
readonly productionDomain?: string;
|
|
10
11
|
}
|
|
11
12
|
declare const GoogleAnalytics: import("svelte").Component<GoogleAnalyticsProps, {}, "">;
|
|
12
13
|
type GoogleAnalytics = ReturnType<typeof GoogleAnalytics>;
|
package/package.json
CHANGED