gtm-module icon indicating copy to clipboard operation
gtm-module copied to clipboard

PageSpeed Insights Issue

Open bart opened this issue 4 years ago • 6 comments

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!

bart avatar Jun 28 '20 23:06 bart

I also have the same concern on the page load speed. Please, tell us how to this can be optimized

yashwp avatar Aug 13 '20 12:08 yashwp

Any update on this ?

dawa-liverpudlian avatar Jan 23 '21 04:01 dawa-liverpudlian

Looks like this project is dead :(

bart avatar Jan 25 '21 20:01 bart

@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,
}

rizkysyazuli avatar May 10 '21 04:05 rizkysyazuli

Hey @rizkysyazuli sounds pretty good. Will try it out! Thank you very much. I'm already using the pageTracking option, too. Yay!

bart avatar May 10 '21 21:05 bart

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

tushar-baldha avatar Aug 31 '21 14:08 tushar-baldha