modules icon indicating copy to clipboard operation
modules copied to clipboard

[Module Listing Request]: `gtag`

Open DamianGlowala opened this issue 1 year ago • 7 comments

Description

This module provides Google Tag integration.

Repository

https://github.com/johannschopplich/nuxt-gtag

npm

https://www.npmjs.com/package/nuxt-gtag

Nuxt Compatibility

Nuxt 3

DamianGlowala avatar Apr 19 '24 16:04 DamianGlowala

@DamianGlowala Thanks a lot! Your preparation steps (and PRs) are amazing.

johannschopplich avatar Apr 19 '24 16:04 johannschopplich

I would love to see the difference or how we can find a way to collaborate with the upcoming https://scripts.nuxt.com/scripts/tracking/google-tag-manager

As I never used GTag, your feedback is welcome 😊

atinux avatar May 03 '24 00:05 atinux

Great question!

Technically, a Google Tag ID is different from a Google Tag Manager. They are primarily used for analytics. While they can be embedded in the Google Tag Manager, the latter contains much more JS, which may be too much for simple analytics purposes.

Nuxt Gtag provides fine-grained options for working with multiple Google Tag IDs (for example, in admin panels where the preferred ID is only known after login), shortcuts like enableAnalytics, composables like useTrackEvent, and GDPR-related options.

It's a more opiniated approach than a generic useGoogleTagManager composable. That's why I'm not sure if it fits into the Nuxt Scripts approach. 🤔

johannschopplich avatar May 03 '24 06:05 johannschopplich

I think we'd love to see this here. It's a solid module and you're a good maintainer. But I want to be cautious about adding a community plugin in the days immediately before we launch Nuxt Scripts, particularly if this is something Nuxt Scripts will end up doing out of the box. Mostly, because it would be annoying for you. (If it's something that will add to what Nuxt Scripts does, then that's great!)

Might be worth putting on pause until Nuxt Scripts is released, at least.

cc: @harlan-zw

danielroe avatar May 03 '24 08:05 danielroe

Sounds like a good plan. Let's wait for Nuxt Scripts. Maybe I can then write a migration path for Nuxt Gtag users.

johannschopplich avatar May 03 '24 09:05 johannschopplich

This is a fantastic module and has captured a lot of the issues that Nuxt Scripts has also tried to solve for all scripts.

I think there could be scope for this module to exist with Nuxt Scripts but it would need to solve some GA specific DX issues that Nuxt Scripts isn't already solving. Some of which it is already doing:

  • initCommands
  • simplifying google consent
  • useTrackEvent

The APIs for nuxt/scripts (you should already have access) are pretty much complete with just documentation and testing remaining, any feedback you have in terms of how it and this module can work together would be appreciated.

Would be especially interested to hear your thoughts on your module building on top of the Nuxt Scripts useScriptGoogleAnalytics() composable.

harlan-zw avatar May 03 '24 14:05 harlan-zw