nuxt-umami
Advanced tools
Comparing version 2.6.1 to 2.6.2-beta.1
@@ -0,1 +1,70 @@ | ||
interface ModuleOptions { | ||
/** | ||
* Your umami endpoint. This is where you would | ||
* normally load the script from. | ||
* @required true | ||
* @example 'https://ijkml.xyz/' | ||
*/ | ||
host?: string; | ||
/** | ||
* Unique identifier provided by Umami | ||
* | ||
* @required true | ||
* @example `3c255b6d-678a-42dd-8074-272ee5b78484` | ||
*/ | ||
id?: string; | ||
/** | ||
* Configure the tracker to only run on specific domains. | ||
* Provide an array or comma delimited list of domains (without 'http'). | ||
* Leave as `undefined` to run on all domains. | ||
* | ||
* @example `mywebsite.com, mywebsite2.com` | ||
* @example ['mywebsite.com', 'mywebsite2.com'] | ||
* @default undefined | ||
*/ | ||
domains?: string | string[]; | ||
/** | ||
* @deprecated | ||
* This option has been deprecated and is | ||
* just here for compatibility. | ||
*/ | ||
ignoreDnt?: boolean; | ||
/** | ||
* Option to automatically track page views. | ||
* | ||
* @default true | ||
*/ | ||
autoTrack?: boolean; | ||
/** | ||
* Whether or not to track during development (localhost). | ||
* | ||
* @default false | ||
*/ | ||
ignoreLocalhost?: boolean; | ||
/** | ||
* Version of Umami used, either `1.x.x` or `2.x.x` | ||
* | ||
* @default 1 | ||
*/ | ||
version?: 1 | 2; | ||
/** | ||
* Self-hosted Umami lets you set a COLLECT_API_ENDPOINT, which is: | ||
* - `/api/collect` by default in Umami v1 | ||
* - `/api/send` by default in Umami v2. See Umami [Docs](https://umami.is/docs/environment-variables). | ||
*/ | ||
customEndpoint?: `/${string}`; | ||
/** | ||
* Enable `v-umami` directive | ||
* | ||
* @default false | ||
*/ | ||
useDirective?: boolean; | ||
/** | ||
* Enable warning and error logs in prod | ||
* | ||
* @default false | ||
*/ | ||
debug?: boolean; | ||
} | ||
interface BasicPayload { | ||
@@ -47,2 +116,3 @@ url: string; | ||
FetchResult, | ||
ModuleOptions, | ||
}; |
@@ -71,9 +71,3 @@ import type { | ||
type DetectiveParams = Parameters<typeof debug>; | ||
return enabled | ||
? function (...params: DetectiveParams) { | ||
debug(...params); | ||
} | ||
: function (..._params: DetectiveParams) {}; | ||
return enabled ? debug : (..._params: Parameters<typeof debug>) => void 0; | ||
}); | ||
@@ -84,7 +78,7 @@ | ||
return (Array.isArray(domains) && domains.length) | ||
? domains.filter(isValidString) | ||
: isValidString(domains) | ||
? domains.split(',').map(d => d.trim()).filter(isValidString) | ||
: undefined; | ||
if (Array.isArray(domains) && domains.length) | ||
return domains.filter(isValidString); | ||
else if (isValidString(domains)) | ||
return domains.split(',').map(d => d.trim()).filter(isValidString); | ||
else return undefined; | ||
}); | ||
@@ -177,2 +171,2 @@ | ||
export { isValidString, preflight, getPayload, collect, earlyPromise, umConfig, helloDebugger }; | ||
export { collect, umConfig, preflight, getPayload, earlyPromise, isValidString, helloDebugger }; |
{ | ||
"name": "nuxt-umami", | ||
"type": "module", | ||
"version": "2.6.1", | ||
"version": "2.6.2-beta.1", | ||
"description": "Integrate Umami Analytics into Nuxt", | ||
@@ -6,0 +6,0 @@ "author": "ML <me.mlaure@gmail.com>", |
@@ -5,7 +5,11 @@ import { directive } from '../internal/directive'; | ||
let autoTrackEnabled = false; | ||
export default defineNuxtPlugin({ | ||
name: 'umami-tracker', | ||
async setup(nuxtApp) { | ||
const { useDirective } = umConfig.value; | ||
const { useDirective, autoTrack } = umConfig.value; | ||
autoTrackEnabled = autoTrack; | ||
if (useDirective) | ||
@@ -16,4 +20,3 @@ nuxtApp.vueApp.directive('umami', directive); | ||
'page:finish': function () { | ||
const { autoTrack } = umConfig.value; | ||
if (!autoTrack) | ||
if (!autoTrackEnabled) | ||
return; | ||
@@ -27,4 +30,5 @@ | ||
// to wait for the update to finish, to capture title | ||
// https://github.com/nuxt/nuxt/blob/3dbe7ce3482dac7c7ca06eb5a2eee23a7fcad2ac/packages/nuxt/src/head/runtime/plugins/unhead.ts#L35 | ||
}, | ||
}, | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24330
10
449
1
1