Skip to content

Commit 54ba04a

Browse files
refactor: streamline hostname handling
1 parent fab461e commit 54ba04a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/runtime/plugin.client.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ export default defineNuxtPlugin({
1212
if (!options.enabled)
1313
return
1414

15-
const ignoredHostnames = options.ignoredHostnames ?? []
16-
1715
init({
1816
domain: options.domain || window.location.hostname,
1917
endpoint: joinURL(
@@ -25,10 +23,10 @@ export default defineNuxtPlugin({
2523
outboundLinks: options.autoOutboundTracking,
2624
fileDownloads: options.fileDownloads,
2725
formSubmissions: options.formSubmissions,
28-
captureOnLocalhost: !ignoredHostnames.includes('localhost'),
26+
captureOnLocalhost: !options.ignoredHostnames.includes('localhost'),
2927
logging: options.logIgnoredEvents,
3028
// Handle non-localhost ignored hostnames (e.g. staging/preview domains)
31-
transformRequest: buildHostnameFilter(ignoredHostnames, options.ignoreSubDomains),
29+
transformRequest: buildHostnameFilter(options.ignoredHostnames, options.ignoreSubDomains),
3230
})
3331

3432
const plausible = {

0 commit comments

Comments
 (0)