question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page titles not always showing in GA dashboard

See original GitHub issue

Description

Page titles not always reporting correctly.

Expected behavior

Page <title> tag should be reflected as the page name in the GA dashboard. E.g. <title>My page title</title> should show as “My page title”.

Actual behaviour

The page title isn’t always logged and instead sometimes falls back to the page’s path ‘/page-title’. This essentially displays the same page as two separate entries in GA’s dashboard under “Page title and screen name” leading to confusion.

Environment

Nuxt v2.15.6 using vue-gtag as a plugin:

import VueGtag from 'vue-gtag'

export default ({ app, $config: { googleAnalytics, env } }) => {
    Vue.use(
      VueGtag,
      {
        config: { id: googleAnalytics }
      },
      app.router
    )
  } 
}


Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
oripkacommented, Aug 13, 2022

I ended up not using the vue router integration but tracking the page views manually:

pages/example.vue

<script setup>
...
import { pageview } from 'vue-gtag'

pageview(
  {
    page_path: "/item/1",
    page_location: "https://example.com",
    page_title: "Example"
  }
);
</script>

plugins/vue-gtag.client.js

import VueGtag from 'vue-gtag'

export default defineNuxtPlugin((nuxtApp) => {
    nuxtApp.vueApp.use(VueGtag, {
        config: {
            id: 'G-XXXXXXXX',
        }
    })
})
1reaction
vedmantcommented, Aug 11, 2022

There is another way:

/plugins/analytics.js

import Vue from 'vue'
import VueGtag from 'vue-gtag'

export default ({ app, $config }) => {
  Vue.use(VueGtag, {
    config: { id: $config.gtagId },
    appName: $config.name,
    pageTrackerTemplate: (to, from) => to.fullPath,
  }, app.router)
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

[GA4] Pages and screens report - Analytics Help
The Pages and screens report shows you the pages on your website and screens on your mobile app that people are visiting and...
Read more >
How to Use The Pages and Screens Report in Google ...
When you first access the report, you'll see your data broken down according to page title and screen class. This means you're looking...
Read more >
Google Analytics in Google Data Studio: Extracting ...
This says…. if the first calculated field for the dashboard name is NULL, use the Google Analytics field called “Page Title” as the...
Read more >
How to Show Page Title In Google Analytics instead of URL
By default, Google Analytics Reports are a little hard to read when you're looking at the Behavior -- Overview report. This video shows...
Read more >
why does Google Analytics show different top content results ...
The best way would be showing title as second dimension, and url as first. You can find out if you have duplicate titles...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found