Caching Gtag events on server #21
Closed
RomanSkrypnik
started this conversation in
Ideas
Replies: 1 comment
-
That's right, Gtag.js itself can't be used on the server. The composables provided by this module are SSR-safe. Meaning that they won't have an effect server-side but will trigger and event in the client. Collecting events and appending them after hydration doesn't make sense to me, because e.g. // This will have no effect on the server, but track the event
// in the client after Nuxt hydration
useTrackEvent('login') |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As we know it's not possible to obtain
window
object on server sideSo, is that possible to cache all fired events on server and append them to
dataLayer
when client side is rendered?For example:
useState
- if we useuseState
on server side, its last assigned value will be saved on client side alsoIf it's not possible, could you please describe why?
Beta Was this translation helpful? Give feedback.
All reactions