Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuxt-gtag

Package Overview
Dependencies
Maintainers
0
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-gtag - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

14

dist/module.d.ts

@@ -6,10 +6,16 @@ import * as _nuxt_schema from '@nuxt/schema';

/**
* Whether to enable the Google tag module for the current environment.
*
* @default true
*/
enabled?: boolean;
/**
* Whether to initialize the Google tag script immediately after the page has loaded.
*
* @remarks
* Set this to `false` to delay the initialization until you call the `enable` function manually.
* Set this to `manual` to delay the initialization until you call the `initialize` function manually.
*
* @default true
* @default 'auto'
*/
enabled?: boolean;
initMode?: 'auto' | 'manual';
/**

@@ -80,4 +86,4 @@ * The Google tag ID to initialize.

}
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
export { type ModuleOptions, _default as default };
{
"name": "nuxt-gtag",
"version": "2.1.0",
"version": "3.0.0",
"configKey": "gtag",

@@ -9,5 +9,5 @@ "compatibility": {

"builder": {
"@nuxt/module-builder": "0.8.1",
"@nuxt/module-builder": "0.8.3",
"unbuild": "2.0.0"
}
}

@@ -13,3 +13,3 @@ import { withQuery } from "ufo";

initGtag({ tags });
if (!options.enabled)
if (options.initMode === "manual")
return;

@@ -16,0 +16,0 @@ const strategy = options.loadingStrategy === "async" ? "async" : "defer";

{
"name": "nuxt-gtag",
"type": "module",
"version": "2.1.0",
"packageManager": "pnpm@9.5.0",
"version": "3.0.0",
"packageManager": "pnpm@9.8.0",
"description": "Natively integrates Google Tag into Nuxt",

@@ -45,17 +45,17 @@ "author": "Johann Schopplich <hello@johannschopplich.com>",

"dependencies": {
"@nuxt/kit": "^3.12.3",
"@nuxt/kit": "^3.13.0",
"defu": "^6.1.4",
"pathe": "^1.1.2",
"ufo": "^1.5.3"
"ufo": "^1.5.4"
},
"devDependencies": {
"@nuxt/eslint-config": "^0.3.13",
"@nuxt/module-builder": "^0.8.1",
"@nuxt/schema": "^3.12.3",
"@types/node": "^20.14.10",
"bumpp": "^9.4.1",
"eslint": "^9.6.0",
"nuxt": "^3.12.3",
"typescript": "^5.5.3"
"@nuxt/eslint-config": "^0.5.2",
"@nuxt/module-builder": "^0.8.3",
"@nuxt/schema": "^3.13.0",
"@types/node": "^20.16.1",
"bumpp": "^9.5.2",
"eslint": "^9.9.1",
"nuxt": "^3.13.0",
"typescript": "^5.5.4"
}
}

@@ -162,3 +162,3 @@ ![Nuxt Google Tag module](./.github/social-card.jpg)

For even more control than the [consent mode](#google-consent-mode), you can delay the loading of the `gtag.js` script until the user has granted consent to your privacy policy. Set the `enabled` option to `false` to prevent loading the `gtag.js` script until you manually enable it:
For even more control than the [consent mode](#google-consent-mode), you can delay the loading of the `gtag.js` script until the user has granted consent to your privacy policy. Set the `initMode` option to `manual` to prevent loading the `gtag.js` script until you initialize it manually.

@@ -170,3 +170,3 @@ ```ts

gtag: {
enabled: false,
initMode: 'manual',
id: 'G-XXXXXXXXXX'

@@ -209,3 +209,4 @@ }

| --- | --- | --- | --- |
| `enabled` | `boolean` | `true` | Whether to initialize the Google tag script immediately after the page has loaded. |
| `enabled` | `boolean` | `true` | Whether to enable the Google tag module for the current environment. |
| `initMode` | `string` | `auto` | Whether to initialize the Google tag script immediately after the page has loaded. |
| `id` | `string` | `undefined` | The Google tag ID to initialize. |

@@ -396,2 +397,33 @@ | `initCommands` | See `initCommands` of `GoogleTagOptions` | `[]` | Commands to be executed when the Google tag ID is initialized. |

## Migration
### v2.x to v3.x
In v2.x and earlier, the `enabled` option was used to control manual initialization of the Google tag script. This option has been replaced with `initMode` in v3.x. To migrate your configuration, set the `initMode` option to `manual`:
```diff
export default defineNuxtConfig({
modules: ['nuxt-gtag'],
gtag: {
- enabled: false,
+ initMode: 'manual',
id: 'GX-XXXXXXXXXX'
}
})
```
The `enabled` option is still available in v3.x, but is now used to disable the Google tag module for the current environment. This is useful if you want to disable the module in development or staging environments:
```ts
export default defineNuxtConfig({
modules: ['nuxt-gtag'],
gtag: {
enabled: process.env.NODE_ENV === 'production',
id: 'G-XXXXXXXXXX'
}
})
```
## Credits

@@ -398,0 +430,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc