Not tracked after the first-page visit.
Mike-Kharkov opened this issue · 8 comments
I have this project:
http://pokritijametallov.ru/
with such param:
`export default {
// Target (https://go.nuxtjs.dev/config-target)
target: 'static',
// Global page headers (https://go.nuxtjs.dev/config-head)
head: {
title: 'pokritie-metallow',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: 'img/favicon.ico' }
],
},
// Global CSS (https://go.nuxtjs.dev/config-css)
css: [
],
// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
plugins: [
],
// Auto import components (https://go.nuxtjs.dev/config-components)
components: true,
// Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
buildModules: [
],
modules: [
'@nuxtjs/gtm',
],
gtm: {
enabled: true, /* see below */
debug: true,
id: 'GTM-PFVKCGB',
layer: 'dataLayer',
variables: {},
pageTracking: true,
pageViewEventName: 'nuxtRoute',
autoInit: true,
respectDoNotTrack: true,
scriptId: 'gtm-script',
scriptDefer: false,
scriptURL: 'https://www.googletagmanager.com/gtm.js',
crossOrigin: false,
noscript: true,
noscriptId: 'gtm-noscript',
noscriptURL: 'https://www.googletagmanager.com/ns.html'
},
// Modules (https://go.nuxtjs.dev/config-modules)
router: {
base: '/'
},
// Build Configuration (https://go.nuxtjs.dev/config-build)
build: {
extend(config, ctx) {
}
}
}
`
This plugin not tracked anything after the first-page visit.
In this link on the project, we can see debug information.
http://joxi.ru/DrlK6ZoCG3WvDA
It seems right but I don't understand why I can't track any of my pages that have nuxt-link and maybe that because of it some problems appeared?
How can I fix that problem?
And why is it happening?
I'm experiencing the same too, I've been checking the Dashboard since Saturday, I can't find any record on the Google Analytics dashboard.
@Mike-Kharkov I've been able to get mine working. Please check that you have created tags and triggers on your GTM container. If Yes; Add a page All PageView event and try again.
PS: It might take sometime before it appears on google analytics.
@Mike-Kharkov If Yes; Add a page All PageView event and try again.
@samalapsy
Where can I find this option?
(Do you mean GTM Option?)
Could you please do some screen about it?
I can confirm this works. Thanks @samalapsy and @LawlietNick.
Wasted a lot of time over the past few days on this. Asked on the discord.com Nuxt page and nothing.
There is no mention of this exact trigger in the Readme.
How did you work it out?
With Debug: true I could see GTM Push statements with every new page, but Network Tab showed only a GET to gtm.js and a GET to analytics.js and then a POST to collect. And nothing else. And on GA Real Time only the first page would appear. My mental model was that the POST would run for each page visit.
I would never have thought of adding that specific trigger (I had a PageView trigger).
I get baffled by these things: how was anyone expected to work this out?
There is the following: "The default event name for page views is nuxtRoute, you can change it by setting the pageViewEventName option." But I think considerable experience with GTM would be needed to work out the Trigger needed.
Can this be added to the Readme?
And I'm now trying to make sense of this line:
Pushing events
You can push events into the configured layer:
this.$gtm.push({ event: 'myEvent', ...someAttributes })
Where would this go?
What I'm trying to do is the clever GTM thing where I can capture things like Clicks on buttons.
I have a CustomEvent with "Some Custom Events" selected and "Click Classes" "contains" and then a crazy vuetify class for a button "v-btn v-btn--is-elevated v-btn--has-bg theme--light v-size--default secondary"
It's not working. I wonder if I have to have the nuxtRoute trigger involved. Or maybe my class selector is wrong.
Arguably a new issue but I'm hoping the readme documentation will be improved - why make life harder...
@Parthian can you try using "Click Element" > "matches CSS selector" > ".some-class"
The "Click Element" returns a DOM element instead of a string of class names. So getting a class from the DOM seems more reliable to me. Just like we usually do when capturing events in JS.
Thanks @rizkysyazuli that's put me on the right track. CustomEvents was wrong, I'll need to read up on what it is for. Successfully seeing events in GA now with Click Element as you describe and Click Text for readability (but of course a bit fragile if the button text is changed in code).
Also using Microsoft Clarity. https://clarity.microsoft.com/ wizardry in action (how it is legal I've no idea). It can be added through Tag Manager.