
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@nuxt-alt/google-analytics
Advanced tools
Google Analytics 4 module for Nuxt
This is a Google Analytics 4 module for nuxt. Since Universal Analytics is going away, there will be no compatibility with it. Everything here is meant for GA4.
@nuxt-alt/google-analytics
dependency to your projectyarn add @nuxt-alt/google-analytics
@nuxt-alt/google-analytics
to the modules
section of nuxt.config.ts
export default defineNuxtConfig({
modules: [
'@nuxt-alt/google-analytics'
],
gAnalytics: {
/* module options */
}
});
measurementId
String
undefined
true
The measurement ID for your google analytics tag. You can find this Id by following these steps:
Stream details
box. generally the ID will look like: G-XXXXXXXXXX
measurementIds
Array
[]
false
This is kind of the same as measurementId
except that you're going to be using an array of objects. Each Object uses an id
, params
and domain
property. This will generate more config gtags if you end up needing to use more than one measurement Id. Do note that measurementId
is still required as you need a base id for the gtag. The domain
property is required if you end up using page_location
in this setup, though its recommended you don't do this since the middleware already handles setting the page_location
.
Example:
export default defineNuxtConfig({
gAnalytics: {
measurementId: 'G-XXXXXXXXXX',
measurementIds: [
{ id: 'G-XXXXXXXXXX', domain: 'https://example.com', params: { page_location: '/' } },
]
}
});
globalParams
Object
{}
false
This sets values that persists across all subsequent gtag calls on the page using gtag('set', { <key>: <value> })
The following composable are available to use (do note, that these only work in the browser):
useGAConsent(arg, params)
- gtag('consent')
equivalentuseGAConfig(params, id)
- gtag('config')
equivalent, id
is optional if you intend to use the main measurement IDuseGAEvent(action, params)
- gtag('event')
equivalentuseGAGet(target, field, callback)
- gtag('get')
equivalentuseGASet(params)
- gtag('set')
equivalentRead more about these functions here
FAQs
An alternative google analytics 4 module for nuxt3
The npm package @nuxt-alt/google-analytics receives a total of 24 weekly downloads. As such, @nuxt-alt/google-analytics popularity was classified as not popular.
We found that @nuxt-alt/google-analytics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.