ga-lite icon indicating copy to clipboard operation
ga-lite copied to clipboard

Universal Analytics implementation (gtag.js API)

Open rfgamaral opened this issue 7 years ago • 10 comments

Google recently started recommending one to track using gtag.js instead of analytics.js and I'm curious how this affects this project, if it affects it at all.

More information: https://developers.google.com/analytics/devguides/collection/gtagjs/migration

Asking this because the recommended way to install ga-lite from the README is a script similar to the old ways of setting up Google Analytics on our pages.

rfgamaral avatar Nov 02 '17 18:11 rfgamaral

Yep, ga-lite imitates the older analytics.js. Perhaps in the future this project will transition towards using the new kind of API, but this is not planned yet.

Universal Analytics (gtag.js) offers a few upgrades to the previous Classic Analytics (analytics.js):

  • Custom variables => custom dimensions and metrics
  • Offline-enabled data sync
  • Android and iOS libraries

jehna avatar Nov 02 '17 19:11 jehna

I'm labeling this issue as "wontfix" for now, but I'll keep it open for the future

jehna avatar Nov 02 '17 19:11 jehna

If you're not closing that label might be a bit misleading though.

Anyway, from your point of view, if one doesn't use those new features, is there no issue in using this lib of yours? All my analytics will still be tracked as if I was using the original version?

Still, is the resume installation still the recommend one? I'm sure I've seen a blog post from you with a different, shorter implementation. Not sure if it was an older or more recent implementation.

rfgamaral avatar Nov 02 '17 23:11 rfgamaral

My experience is that it works perfectly (I've used it on about 5 sites). I have had to re-validate ownership on Google Search Console (Webmaster Tools) using another method such as an html file instead of using analytics.

Respectfully.

Frank Gomez 941-374-7711 Owner / Creative Director Empowered Marketing, LLC dba Frank's Designs Empowered Marketing™ http://www.franksdesigns.com/www.FranksDesigns.com http://www.franksdesigns.com/ www.WPTechGuru.com

On Thu, Nov 2, 2017 at 7:09 PM, Ricardo Amaral [email protected] wrote:

If you're not closing that label might be a bit misleading though.

Anyway, from your point of view, if one doesn't use those new features, is there no issue in using this lib of yours? All my analytics will still be tracked as if I was using the original version?

Still, is the resume installation still the recommend one? I'm sure I've seen a blog post from you with a different, shorter implementation. Not sure if it was an older or more recent implementation.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jehna/ga-lite/issues/47#issuecomment-341584709, or mute the thread https://github.com/notifications/unsubscribe-auth/ADqCK2PK0H0Oywl0E6byrdRirzfcG5Kgks5syku3gaJpZM4QQKK3 .

frank6tg avatar Nov 02 '17 23:11 frank6tg

@rfgamaral

if one doesn't use those new features, is there no issue in using this lib of yours? All my analytics will still be tracked as if I was using the original version?

All analytics (other than #46) are tracked normally. I'm using this in my own projects and it works just fine. You might see some differences in the amount of absolute visitors/events when migrating, because some ad blockers do block analytics.js, but they don't necessarily block ga-lite. But Google Analytics numbers are not absolutely accurate anyways (I'm generally seeing 20-50% less page views at Google Analytics than in my server logs because of the popularity of ad blockers, regardless of if I'm using ga-lite or the official analytics).

Still, is the resume installation still the recommend one? I'm sure I've seen a blog post from you with a different, shorter implementation. Not sure if it was an older or more recent implementation.

The one in README is the most up to date. The 1.x version had a shorter snippet (which is still available from npm/jsdelivr if you liked the old syntax) and it is not supported anymore in the 2.x version. The new 2.0 version introduced many new features, including event tracking, so you might want to use it if you're doing anything else than page view tracking with your Google Analytics.

jehna avatar Nov 03 '17 06:11 jehna

I just noticed something - the note on migrating from v1 - it is fairly important because it affects your bounce rate.

Respectfully.

Frank Gomez 941-374-7711 Owner / Creative Director Empowered Marketing, LLC dba Frank's Designs Empowered Marketing™ http://www.franksdesigns.com/www.FranksDesigns.com http://www.franksdesigns.com/ www.WPTechGuru.com

On Fri, Nov 3, 2017 at 2:44 AM, Jesse Luoto [email protected] wrote:

@rfgamaral https://github.com/rfgamaral

if one doesn't use those new features, is there no issue in using this lib of yours? All my analytics will still be tracked as if I was using the original version?

All analytics (other than #46 https://github.com/jehna/ga-lite/issues/46) are tracked normally. I'm using this in my own projects and it works just fine. You might see some differences in the amount of absolute visitors/events when migrating, because some ad blockers do block analytics.js, but they don't necessarily block ga-lite. But Google Analytics numbers are not absolutely accurate anyways (I'm generally seeing 20-50% less page views at Google Analytics than in my server logs because of the popularity of ad blockers, regardless of if I'm using ga-lite or the official analytics).

Still, is the resume installation still the recommend one? I'm sure I've seen a blog post from you with a different, shorter implementation. Not sure if it was an older or more recent implementation.

The one in README is the most up to date. The 1.x version had a shorter snippet (which is still available from npm/jsdelivr if you liked the old syntax) and it is not supported anymore in the 2.x version. The new 2.0 version introduced many new features, including event tracking, so you might want to use it if you're doing anything else than page view tracking with your Google Analytics.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jehna/ga-lite/issues/47#issuecomment-341631585, or mute the thread https://github.com/notifications/unsubscribe-auth/ADqCK8BCdUkCF3c8Olwmek8Z5R1m1OGwks5syrZUgaJpZM4QQKK3 .

frank6tg avatar Nov 03 '17 10:11 frank6tg

Well, to be honest, I decided to just conditionally load GA if not being crawled by Google PageSpeed Insights: https://github.com/rfgamaral/ricardoamaral.net/commit/a1613798f1c1434c571fc76ad554a3c324e471a9

rfgamaral avatar Nov 03 '17 10:11 rfgamaral

I've switched over to using the gtag format for one of my clients, as they are now running multiple tracking campaigns, so the final bits of JavaScript are something like: gtag('config', 'UA-XXXXXXXX-1'); gtag('event', 'conversion', {'send_to': 'YYYYYYY-YYYYYY});

It isn't clear to me, if ga-lite supports this or how to go about implementing it.

jamesjohnmcguire avatar Sep 02 '19 13:09 jamesjohnmcguire

@jamesjohnmcguire Seems that you're using Google Ads on your site. This piece of code is responsible for sending the conversion information for Google Ads:

gtag('event', 'conversion', {'send_to': 'YYYYYYY-YYYYYY}); (See more: https://support.google.com/google-ads/answer/7548399?hl=en)

ga-lite unfortunately only supports Google Analytics; this project does not support any other Google Tag Manager related projects like Google Ads.

jehna avatar Sep 03 '19 05:09 jehna

Снимок экрана 2021-11-18 в 20 06 03 Google's new way doesn't solve the Web Core Vitals problem

dejurin avatar Nov 18 '21 18:11 dejurin