Comparing version 2.0.7 to 2.1.0
{ | ||
"name": "nuxt-gtag", | ||
"version": "2.0.7", | ||
"version": "2.1.0", | ||
"configKey": "gtag", | ||
@@ -5,0 +5,0 @@ "compatibility": { |
import { withQuery } from "ufo"; | ||
import { gtag, initGtag } from "../gtag.js"; | ||
import { gtag, initGtag, resolveTags } from "../utils.js"; | ||
import { disableAnalytics as _disableAnalytics, enableAnalytics as _enableAnalytics } from "../analytics.js"; | ||
import { resolveTags } from "../utils.js"; | ||
import { useHead, useRuntimeConfig } from "#imports"; | ||
@@ -6,0 +5,0 @@ export function useGtag() { |
import { withQuery } from "ufo"; | ||
import { defineNuxtPlugin } from "nuxt/app"; | ||
import { initGtag } from "./gtag.js"; | ||
import { resolveTags } from "./utils.js"; | ||
import { initGtag, resolveTags } from "./utils.js"; | ||
import { useHead, useRuntimeConfig } from "#imports"; | ||
@@ -6,0 +5,0 @@ export default defineNuxtPlugin({ |
import type { ModuleOptions } from '../module.js'; | ||
import type { GoogleTagOptions } from './types.js'; | ||
export declare function gtag(...args: any[]): void; | ||
/** | ||
* Initialize the Google tag. | ||
*/ | ||
export declare function initGtag({ tags }: { | ||
tags: GoogleTagOptions[]; | ||
}): void; | ||
export declare function resolveTags(options: Required<ModuleOptions>): GoogleTagOptions[]; |
import { toRaw } from "#imports"; | ||
export function gtag(...args) { | ||
window.dataLayer?.push(arguments); | ||
} | ||
export function initGtag({ tags }) { | ||
window.dataLayer = window.dataLayer || []; | ||
for (const tag of tags) { | ||
for (const command of tag.initCommands ?? []) | ||
gtag(...command); | ||
} | ||
gtag("js", /* @__PURE__ */ new Date()); | ||
for (const tag of tags) { | ||
gtag("config", tag.id, tag.config ?? {}); | ||
} | ||
} | ||
export function resolveTags(options) { | ||
@@ -3,0 +17,0 @@ const _options = toRaw(options); |
{ | ||
"name": "nuxt-gtag", | ||
"type": "module", | ||
"version": "2.0.7", | ||
"version": "2.1.0", | ||
"packageManager": "pnpm@9.5.0", | ||
@@ -6,0 +6,0 @@ "description": "Natively integrates Google Tag into Nuxt", |
Sorry, the diff of this file is not supported yet
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
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
31768
23
454