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.

PageSpeed Insights Issue

See original GitHub issue

Hey everyone, improved page speed on a project today but one issue seems to be difficult to solve. I’m using the awesome nuxt GTM module and loading it like this from nuxt.config.js:

gtm: {
    id: '<my-ID>',
    pageTracking: true
  }

Google Pagespeed Insights tells me under “Remove unused JavaScript” the following items:

/gtm.js?id=<my-ID>(www.googletagmanager.com) | 26.2 KB | 12.5 KB
/analytics.js(www.google-analytics.com) | 18.6 KB | 6.7 KB

Is this caused by gtm module (which I don’t think) or by GTM / Analytics / Pagespeed Insights itself?

Maybe you can help me, thank you very much in advance and I really appreciate it!

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:11
  • Comments:6

github_iconTop GitHub Comments

5reactions
rizkysyazulicommented, May 10, 2021

@bart have you tried setting the scriptDefer to true? This should hold the loading of the GTM script until all other scripts are ready. It works for me.

Jepretan Layar 2021-05-10 pukul 10 45 49

And since I also enabled pageTracking. In GTM i also make sure the tag is fired during the “nuxtRoute” custom event instead of the standard “Page View”.

Jepretan Layar 2021-05-10 pukul 10 54 47

Here’s my settings btw:

gtm: {
  scriptDefer: true,
  enabled: process.env.APP_ENV === 'production' ? true : false,
  id: 'GTM-XXXXXX',
  pageTracking: true,
}
0reactions
tushar-baldhacommented, Aug 31, 2021

Hey @rizkysyazuli Its works, Thank you!, Just we need to add “pageTracking: true”

Read more comments on GitHub >

github_iconTop Results From Across the Web

PageSpeed Insights
Make your web pages fast on all devices ; More on PageSpeed InsightsWhat's newDocumentationLearn about Web PerformanceAsk questions on Stack OverflowMailing list.
Read more >
How do I resolve Google PageSpeed Insight errors?
Eliminate render-blocking JavaScript and CSS in above-the-fold content: Your page has 1 blocking CSS resource. This causes a delay in rendering your page....
Read more >
Pagespeed insights page stuck on "Running performance ...
I've tried running a pagespeed insight analysis on a webpage and it's been stuck on "Running performance analysis" for a long time (>15...
Read more >
Google PageSpeed Insights: The Truth About Scoring 100/100
The reality is that Google does use PageSpeed Insights to determine rankings – kind of. Site speed is a ranking factor, plain and...
Read more >
Frequently Asked Questions | PageSpeed Insights
The PageSpeed Insights tools help you diagnose speed and mobilization issues with your site. Updated Nov 3, 2022.
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