@nekm/svelte-core 1.0.5 → 1.0.6
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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {onMount} from "svelte";
|
|
3
|
-
import {assets} from "$app/paths";
|
|
4
3
|
import {browserImportScript} from "@nekm/core";
|
|
5
4
|
import {page} from "$app/state";
|
|
6
5
|
|
|
@@ -11,14 +10,12 @@
|
|
|
11
10
|
readonly id: string;
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
|
-
* Base
|
|
15
|
-
* @default assets
|
|
13
|
+
* Base domain to the site.
|
|
16
14
|
*/
|
|
17
|
-
readonly
|
|
15
|
+
readonly baseDomain: string;
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
const { id,
|
|
21
|
-
const baseUrl = baseUrlProps ?? new URL(assets);
|
|
18
|
+
const { id, baseDomain }: GoogleAnalyticsProps = $props();
|
|
22
19
|
|
|
23
20
|
onMount(() => {
|
|
24
21
|
window.dataLayer = window.dataLayer || [];
|
|
@@ -26,7 +23,7 @@
|
|
|
26
23
|
window.dataLayer.push(arguments);
|
|
27
24
|
}
|
|
28
25
|
window.gtag("js", new Date());
|
|
29
|
-
const config = page.url.hostname !==
|
|
26
|
+
const config = page.url.hostname !== baseDomain ? { debug_mode: true } : {};
|
|
30
27
|
window.gtag("config", id, config);
|
|
31
28
|
|
|
32
29
|
return browserImportScript(`https://www.googletagmanager.com/gtag/js?id=${id}`);
|
|
@@ -4,10 +4,9 @@ export interface GoogleAnalyticsProps {
|
|
|
4
4
|
*/
|
|
5
5
|
readonly id: string;
|
|
6
6
|
/**
|
|
7
|
-
* Base
|
|
8
|
-
* @default assets
|
|
7
|
+
* Base domain to the site.
|
|
9
8
|
*/
|
|
10
|
-
readonly
|
|
9
|
+
readonly baseDomain: string;
|
|
11
10
|
}
|
|
12
11
|
declare const GoogleAnalytics: import("svelte").Component<GoogleAnalyticsProps, {}, "">;
|
|
13
12
|
type GoogleAnalytics = ReturnType<typeof GoogleAnalytics>;
|